Day 25 4/15/98 ``You have to squint a little.''
Is n prime or composite? We want an algorithm that runs in (logn)k .
If p is prime with 1 < a < p then ap-1 = 1modp
If 1 < a < n and an-1 ¹ 1modn then n is composite.
This heuristic fails for certain numbers known as Carmicheal numbers. Example:
561 = 3*11*17
If GCD(a,n) = 1 then an-1 = 1modn
n is Carmicheal if
Carmicheal numbers actually always have ai = 1 and m ³ 3 .
±1 are the only roots of x2 = 1modp with p prime
A( a,n )
let n-1 = 2tu for u odd
half the a Î [1,n] for n composite will have that A(a,n) return 'composite'.
This means that if you run A(a,n) 100 times each time putting out 'possibly prime' then either n is prime or you are very unlucky.
For n = p1a1*...*pmam
we have: Zn @ Zp1a1×Zpmam
For a Î Zn a® (amodp1a1,...,amodpmam)
Zn* = {a Î Zn|$a¢with a¢*a = 1modn} = {a Î Zn|GCD(a,n) = 1}
If p is an odd prime, then Zp* is a cyclic group, which means every invertible element can be found by multiplying some base (a 'generator') modp .
if n = 5*7 then Z35* @ Z5*×Z7* @ C4*C6 then there will be many solutions to x2 = 1mod35 .
For 35, x = 1,6,-6,34 will work.
Working in the decomposed group, we get:
62 = 1mod35 = a 'nontrivial square root of 1' => 35 is composite.