A positive integer

is prime if its only divisors are

and

(Fundamental Theorem of Arithmatic) Every positive integer

can be written uniquely
as
where

and

If

is a finite group of order

then

for every element

of

Proof: The theorem is true for any finite group, but we will
prove it only for the abelian case. Write out the elements of

as

If we multiply each element by

then we have the set

Because we can cancel in

these two sets must be equal. Multiplyting them together we get

Cancelling leaves

(Fermat's Little
Theorem) If

is a prime number and

is any integer not divisible by

then
Proof: If

is prime, the non-zero elements of

from a group of order

under
multiplication
Note that

does not imply

is prime.
A Fermat pseudoprime base b is a composite number

which satisfies the Fermat condition

.
For example

but

A Carmichael number is a pseudoprime for every possible base

:
that is, for every

coprime to

.
It was recently shown that there infinitely many of these numbers. The
carmichael numbers less than 10,000 are

For
example



etc.
Euler's Totient function,

is the number of positive integers less than

and relatively prime to


for a prime and

if

and

are primes
(Euler's Totient Theorem) If

then

Proof: The integers relatively prime to

form a group under multiplication modulo

of order

Testing

for primality. We may assume

is odd.
Write
Choose an integer

and compute the
sequence
If

is prime, then we know that

.
However, there may be an earlier element in the list with residue

Let

be the smallest value such that

Two cases:
Case 1

In this case

Case 2

Then

Therefore

divides one of these products. By choice of


does not divide

Therefore

divides

implies

If

is prime, then either

or

for some

If

does not pass this test it is composite. If the number does pass the test, it
might be composite.
final int COMPOSITE = 1;
final int INCONCLUSIVE = 2;
int Test(int n){
Find

such that


random(2,n-2);
if

return INCONCLUSIVE;
for (int j = 0; j < k; j++)
if
(
return INCONCLUSIVE
return COMPOSITE;
}
If the function returns
COMPOSITE then the number is composite. If it returns
INCONCLUSIVE then the number may be prime or composite. However,
we can actually compute the probability the number is composite.
Note. Could also think of INCONCLUSIVE as Probably Prime.
(Miller-Rabin) If Test(n) returns
INCONCLUSIVE the number

is composite with probability
<
If you repeat Test(n)

times with

independent choices of

then

is prime with probability



















Agrawal, Kayal and Saxena published a paper on 6 August 2002 entitled PRIMES is in P. They found a deterministic algorithm which always prime or not prime and does it in polynomial time. It is, however, still relatively slow.
If

are rings, then the Cartesian product of the rings

is a ring under componetwise addition and multiplication
Let

be pairwise relatively prime integers, that is,

Then

There is a

correspondence given by

Example


Let

be pairwise relatively prime integers, that is,

Then the system of
congruences
has
a unique solution modulo

Example


implies that

Substitute this into the second equation to get

Since

and

are relatively prime,

has an inverse mod

so we can solve for

to get

Use this to find

Check.


By our previous theorem, we know that if

then

The smallest integer

such that

is called the order of

mod

If the order

is

then we say that

is a primitive root of n.
If

is a primitive root of

then every number

such that

is of the form

for some

Proof The powers

are unique and there are

of
them.
For any prime number

integer

primitive root

of

there is an a unique integer

such that



The powers of

are

so

is a primitive root of

However, the powers of

are

so

is not a primitive root of

| n | index |
![]() ![]() |
![]() ![]() |
![]() ![]() |
![]() ![]() |
![]() ![]() |
![]() ![]() |
![]() ![]() |
![]() ![]() |
![]() ![]() |
![]() ![]() |
![]() ![]() |
![]() ![]() |
![]() ![]() |
![]() ![]() |
![]() ![]() |
![]() ![]() |
![]() ![]() |
![]() ![]() |
![]() ![]() |
![]() ![]() |
In analogy with traditional logarithms, we define the discrete logarithm
of

base

to be the unique integer

such that

Given

and

it is trivial to write an algorithm to find

simply by computing powers of

up to

and finding the index

such that

If

is large, this is not feasible. Apparently, computing a discrete logarithm
is as difficult as factoring a number.