View
221
Download
0
Embed Size (px)
Citation preview
PRIMESPRIMES
K. -C. Yang and J. -L. LinK. -C. Yang and J. -L. Lin
National Tsing Hua UniversityNational Tsing Hua University
OUTLINEOUTLINE
Definition And History of PrimeDefinition And History of Prime PRIMES is in PPRIMES is in P
Previous ResearchesPrevious Researches Basic Idea and ApproachBasic Idea and Approach Preliminary NotationPreliminary Notation The Algorithm And VerificationThe Algorithm And Verification Time Complexity AnalysisTime Complexity Analysis Future WorksFuture Works
HistoryHistory
DefinitionDefinition Let Let pp N N and and pp > 1, > 1, pp is prime if it has is prime if it has
no positive divisor other than 1 and no positive divisor other than 1 and pp.. HistoryHistory
Pythagoras Pythagoras (580 BC ~ 300 BC)(580 BC ~ 300 BC)
Integer (odd, even, prime, …), Rational and Integer (odd, even, prime, …), Rational and Irrational number, Pythagorean Theorem…Irrational number, Pythagorean Theorem…
Euclid Euclid (300 BC)(300 BC)
There are an infinite number of primes.There are an infinite number of primes.
History (2)History (2)
pf.pf. Assume there are finite number of Assume there are finite number of
primes.primes. LetLet p p11, …, , …, ppnn be all primes, and let be all primes, and let NN = =
pp11pp22……ppnn + 1 + 1
NN is a composite number and is a composite number and
NN has a prime factor has a prime factor pp pp11, …, , …, ppnn
ContradictionContradiction
niNpi ...1 |
History (3)History (3)
How to determine if a number is prime?How to determine if a number is prime? Sieve of Eratosthenes Sieve of Eratosthenes (240 BC)(240 BC)
If If nn is composite, then is composite, then nn has a positive has a positive divisor less than or equal to divisor less than or equal to nn1/21/2. So to d. So to determinate whether eterminate whether nn is prime, you ca is prime, you can try dividing n to every n try dividing n to every mm < < nn1/21/2. This is . This is an exponential-time algorithm O(an exponential-time algorithm O(nn1/2 1/2 lolog g nn).).
PRIMES is in P - O(logPRIMES is in P - O(logkk nn) for ) for kk≧1.≧1.
Fermat (1)Fermat (1)
Fermat’s Last Theorem Fermat’s Last Theorem (AD 1637)(AD 1637)
xxnn + + yynn = = zznn has no integer solution for has no integer solution for nn > > 22
Proven by Wiles Proven by Wiles (AD 1995)(AD 1995)
Fermat’s Little Theorem Fermat’s Little Theorem (AD 1640)(AD 1640)
aa NN and and pp is prime, then is prime, then aapp-1-1 ≡1 (mod ≡1 (mod pp)) e.g.e.g.
pp = 2, = 2, aa = 3, then 3 = 3, then 322 ≡ 1 (mod 2) ≡ 1 (mod 2) pp = 3, = 3, aa = 4, then 4 = 4, then 433 ≡ 1 (mod 3) ≡ 1 (mod 3)
p | ap-1 - 1
Fermat (2)Fermat (2)
pf. of Fermat’s little theorem (by inductiopf. of Fermat’s little theorem (by induction)n) aapp-1-1 ≡1 (mod ≡1 (mod pp) ) aapp - - a a ≡ 0 (mod ≡ 0 (mod pp) ) pp | | aapp - - aa Assume Assume pp | | aapp - - aa, then examine (, then examine (a a + 1)+ 1)pp - ( - (a a + 1)+ 1) (binomial theorem)(binomial theorem) pp divides the right side, so it also divides the le divides the right side, so it also divides the le
ft side.ft side. pp | ( | (aa + 1) + 1)pp - ( - (aapp + 1) + ( + 1) + (aapp - - aa) = ) = ((aa + 1) + 1)pp - ( - (aa + 1) + 1) The hypothesis is true for any The hypothesis is true for any aa..
11
...21
)1( 21
a
p
pa
pa
paa pppp
ap
pa
pa
paa pppp
1...
21)1()1( 21
!
)1)...(1( |
i
ippp
i
pp
Fermat (3)Fermat (3)
Time complexity – O(lg Time complexity – O(lg nn)) If If aapp-1-1 ≡1 (mod ≡1 (mod pp) for ) for aa NN , , pp is prime? is prime?
It fails!It fails! 341341
341 = 11 × 31341 = 11 × 31 22340340 ≡1 (mod 341) ≡1 (mod 341)
Pseudo primes: 341, 561 , 645, 1105…Pseudo primes: 341, 561 , 645, 1105…
Previous ResearchesPrevious Researches 1975, Miller designed a test based on 1975, Miller designed a test based on Fermat Little TheFermat Little The
oremorem deterministic polynomial-time algorithm – O(logdeterministic polynomial-time algorithm – O(log44 nn)) Assuming Extended Riemann HypothesisAssuming Extended Riemann Hypothesis
1980, Miller’s algorithm was modified by Rabin1980, Miller’s algorithm was modified by Rabin Unconditional but randomized polynomial-timeUnconditional but randomized polynomial-time
1983, Adleman, Pomerance and Rumely1983, Adleman, Pomerance and Rumely deterministic in (log deterministic in (log nn))O(logloglog O(logloglog nn))
1986, Goldwasser and Kilian1986, Goldwasser and Kilian randomized polynomial-time algorithm (on almost all input)randomized polynomial-time algorithm (on almost all input)
1992, G-K algorithm was modified by Adleman and H1992, G-K algorithm was modified by Adleman and Huanguang randomized polynomial-time algorithm on all inputsrandomized polynomial-time algorithm on all inputs
2002, Manindra Agrawal, Neeraj Kayal, and Nitin Saxe2002, Manindra Agrawal, Neeraj Kayal, and Nitin Saxenana deterministic polynomial-time O(logdeterministic polynomial-time O(log7.5+7.5+εεnn)) by using algebraby using algebra
Riemann Hypothesis (1)Riemann Hypothesis (1)
In 1859, proposed by RiemannIn 1859, proposed by Riemann Hilbert’s problemsHilbert’s problems
23 problems. The Second International Con23 problems. The Second International Congress of Mathematicians, 1900.gress of Mathematicians, 1900.
Three of Hilbert’s problems remain uncoThree of Hilbert’s problems remain unconquered.nquered. 6. Can physics be axiomized? 6. Can physics be axiomized? 8. Riemann hypothesis.8. Riemann hypothesis. 16. Develop a topology of real algebraic curves a16. Develop a topology of real algebraic curves a
nd surfaces.nd surfaces. Partial answer by Oxenhielm, Stockholm University, 2Partial answer by Oxenhielm, Stockholm University, 2
003 003
Riemann Hypothesis (2)Riemann Hypothesis (2) Riemann zeta functionRiemann zeta function
Trivial zero pointTrivial zero point -2, -4, -6, -8, …-2, -4, -6, -8, …
Riemann HypothesisRiemann Hypothesis non trivial zero point in Reimann zeta functinon trivial zero point in Reimann zeta functi
on, σ= ½.on, σ= ½. Clay Mathematics InstituteClay Mathematics Institute
$1000000 for the solution to this problem. $1000000 for the solution to this problem. (2000. (2000. 5)5)
itsns n
s
, 1
)(
1
1
PRIMES is in PPRIMES is in P
Manindra Agrawal, Neeraj KayManindra Agrawal, Neeraj Kayal, and Nitin Saxena al, and Nitin Saxena
August 6, 2002August 6, 2002
Basic Idea and Approach Basic Idea and Approach (1)(1)
Let aLet aZZ, n, nNN, and (a, n) = 1. Then n is pr, and (a, n) = 1. Then n is prime iffime iff ((XX + + aa))nn≡(≡(XXnn + + aa) (mod ) (mod nn)) pf.pf. If If nn is prime is prime nn | ( | (XX + + aa))nn – ( – (XXnn + + aa)) ((XX - - aa))nn≡(≡(XXnn - - aa) (mod ) (mod nn)) If If nn is composite is composite, let , let qq be prime, be prime, qqkk | | nn, but , but qqkk+1+1 | | nn nn | ( | (XX + + aa))nn – ( – (XXnn + + aa)) ((XX - - aa))nn≡(≡(XXnn - - aa) (mod ) (mod nn))
nnnnn XaXn
nXa
naaX
11
1...
1)(
qqnk Xaq
nq
|
!
)1)...(1(
i
innn
i
n
an – a = a(an-1 – 1)∵n | an-1 -1 (Fermat’s little thm) n | an - a
1
)!1(
)1)...(1( kqqq
qnnn
q
n
(n, a) = 1 (qk, an-q) = 1
Basic Idea and Approach Basic Idea and Approach (2)(2)
To evaluate To evaluate nn coefficients, it costs time Ω( coefficients, it costs time Ω(nn).). To shorten the number of coefficients, we uTo shorten the number of coefficients, we u
sese ((xx + + aa))nn ≡ ( ≡ (xxnn + + aa) (mod ) (mod xxrr – 1, – 1, nn)) If If pp is prime, the above congruence holds. is prime, the above congruence holds. However, some composite numbers still satHowever, some composite numbers still sat
isfy this congruence.isfy this congruence. For appropriate r, n must be a prime power.
e.g. 3e.g. 333, 7, 755, 2×3×5, 2×3×5
Basic AlgorithmBasic Algorithm
Input Input n n > 1> 11. If (1. If ( n n = = aabb for some a for some a NN and and bb > 1), output C > 1), output C
OMPOSITE.OMPOSITE.2. Find the smallest 2. Find the smallest rr such that such that oorr((nn) > 4log) > 4log22nn..3. If (gcd(3. If (gcd(nn, , aa) > 1 for some ) > 1 for some aa ≦ ≦ rr) , output CO) , output CO
MPOSITE.MPOSITE.4. If (4. If (nn ≦ ≦ rr), output PRIME.), output PRIME.5. For 5. For aa = 1 to = 1 to do do if if , output COMPOSIT , output COMPOSIT
E.E.6. Output PRIME. 6. Output PRIME.
nr log)(2
)),1(mod )(( nxaxax rnn
Notation: or(n) = d denotes the smallest positive integer d s.t. nd ≡ 1 (mod r)Notation2: ψ(r) = |k|, where k < r and (k, r) = 1
Preliminary Notation (1)Preliminary Notation (1)
FFnn denotes the finite field, where denotes the finite field, where nn is a prime. is a prime. Let Let n n andand r r be prime be prime numbers, n numbers, n ≠≠ r. r.
1. The multiplicative group of any field F1. The multiplicative group of any field Fnn, denoted , denoted by Fby Fnn
* * is cyclic.is cyclic.2. Let f(x) be a polynomial with integral coefficient2. Let f(x) be a polynomial with integral coefficient
s. Thens. Then f(x)f(x)nn≡ f(x≡ f(xnn) (mod n)) (mod n)3. Let h(x) be any factor of x3. Let h(x) be any factor of xrr - 1. Let m≡m - 1. Let m≡mrr (mod r). (mod r).
Then Then xxmm ≡ x ≡ xmmrr (mod h(x)) (mod h(x))
4. In F4. In Fnn, factorizes into irreducible polynomial , factorizes into irreducible polynomial each of degree oeach of degree orr(n).(n).
1
1
x
xr
Preliminary Notation (2)Preliminary Notation (2) Let Let ff((xx) be a polynomial with integral coefficients. Then) be a polynomial with integral coefficients. Then ff((xx))nn≡ ≡ ff((xxnn) (mod ) (mod nn)) pf.pf.
Let Let ff((xx) = ) = aa00 + … + + … + aaddxxdd. The coefficient . The coefficient ccii of of xxii in in ff((xx))nn is is
nn | | ccii unless some unless some iijj is is nn. In this exception case, . In this exception case, iimm = 0 for all = 0 for all m m ≠ ≠ jj..
ii = = j j ×× i ijj = = njnj. And . And ccnjnj = = aajjnn (mod (mod nn). Therefore, ). Therefore, ccnjnj ≡ ≡ aajj (mod (mod nn) )
(Fermat’s Little Theorem)(Fermat’s Little Theorem)ff((xx))nn ≡ ≡ cc00 + + ccnnxxnn + + cc22nnxx22nn + … + + … + ccndndxxndnd (mod (mod nn) ) ≡ ≡ aa00 + + aa11xxnn + + aa22xx22nn + … + + … + aaddxxndnd (mod (mod nn)) ≡ ≡ ff((xxnn) (mod ) (mod nn))
idiiinii d
id
ij
ii
d
d
dj
ii
naaac
...2... 0
0
21
0
0
!!...
!...... xi1 × x2i2 × … × xdid = xi1+2i2…+did
cnj = aj
n + n ×Δ
Preliminary Notation (3)Preliminary Notation (3)
Let Let hh((xx) be any factor of ) be any factor of xxrr – 1. Let – 1. Let mm≡≡mmrr (mod (mod rr). Then). Then
xxmm ≡ ≡ xxmmrr (mod (mod hh((xx)))) pf.pf. Let Let mm = = krkr + + mmrr. Now. Now
xxrr ≡ 1 (mod ≡ 1 (mod xxrr - 1) - 1) xxkrkr ≡ 1 (mod ≡ 1 (mod xxrr - 1) - 1) xxkrkr++mmrr ≡ ≡ xxmmrr (mod (mod xxrr - 1) - 1) xxmm ≡ ≡ xxmmrr (mod (mod xxrr - 1) - 1) xxmm ≡ ≡ xxmmrr (mod (mod hh((xx))))
xr-1 | xm-xmr
h(x) ×Δ | xm-xmr
h(x) | xm-xmr
Preliminary Notation (4)Preliminary Notation (4) In In FFnn, factorizes into irreducible polynomial each o, factorizes into irreducible polynomial each o
f degree f degree oorr((nn).).Let Let d = od = orr((nn) and ) and hh((xx) be a irreducible factor of ) be a irreducible factor of with with
degree degree kk.. FFnn[[xx]/]/hh((xx) forms a field of size ) forms a field of size nnkk and the multiplicative and the multiplicative
subgroup of subgroup of FFnn[[xx]/]/hh((xx) is cyclic with a generator ) is cyclic with a generator gg((xx) (by ) (by fact 1). We havefact 1). We have
gg((xx))nn ≡ ≡ gg((xxnn) (fact 2)) (fact 2) gg((xx))nndd ≡ ≡ gg((xxnndd))
gg((xx))nndd ≡ ≡ gg((xx)) gg((xx))nndd-1-1 ≡ 1 ≡ 1∵ ∵ Order of Order of gg((xx) = () = (nnkk - 1), ∴( - 1), ∴(nnkk - 1)|( - 1)|(nndd - 1) - 1) k k | | dd.. ∵ ∵ hh((xx) | () | (xxrr – 1), we also have – 1), we also have xxrr ≡ 1 in ≡ 1 in FFnn[[xx]/]/hh((xx) ) orde order of r of xx in this field must be in this field must be rr (∵ (∵ rr is prime). Therefore, is prime). Therefore, rr | (| (nnkk - 1), i.e. - 1), i.e. nnkk ≡ 1 (mod ≡ 1 (mod rr))Hence, Hence, dd | | kk. Therefore, . Therefore, kk = = dd..
1
1
x
xr
g(xn) ≡ g(xn)g(xn)n ≡ g(xn2)g(xn2)n ≡ g(xn3)
…g(x)nd ≡ g(xnd)
pn ≡ 1 (mod r) xnd ≡ x1 (mod h(x)) (by fact 3)g(xnd) ≡ g(x)
1
1
x
xr
AlgorithmAlgorithm
Input Input n n > 1> 11. If ( 1. If ( aa NN and and bb > 1 s.t. > 1 s.t. nn = = aabb ), output COMPOSI ), output COMPOSI
TE.TE.2. Find the smallest 2. Find the smallest rr such that such that oorr((nn) > 4log) > 4log22nn..3. If ( 3. If ( aa ≦ ≦ rr s.t. 1 < gcd( s.t. 1 < gcd(nn, , aa) < ) < nn ) , output COMPOS ) , output COMPOS
ITE.ITE.4. If (4. If (nn ≦ ≦ rr), output PRIME.), output PRIME.5. For 5. For aa = 1 to = 1 to do do if if , output COMPOSITE. , output COMPOSITE.6. Output PRIME. 6. Output PRIME.
nr log)(2
)),1(mod )(( nxaxax rnn
Notation: (n, r) = 1, or(n) = d denotes the smallest positive integer d s.t. nd ≡ 1 (mod r)Notation2: ψ(r) = |k|, where k < r and (k, r) = 1
Correctness (1)Correctness (1)
Lemma. If n is prime, the algorithm returLemma. If n is prime, the algorithm returns PRIME.ns PRIME.
pf.pf.1. Step 1 and Step 3 can never return COMPOSIT1. Step 1 and Step 3 can never return COMPOSIT
E.E. nn≠≠aabb
((aa, , nn) = 1 or ) = 1 or nn a a ≦ ≦ rr2. Step 5 also can not return COMPOSITE.2. Step 5 also can not return COMPOSITE.
If p is prime, (If p is prime, (xx + + aa))nn ≡ ( ≡ (xxnn + + aa) (mod ) (mod xxrr – 1, – 1, nn) holds) holds It returns PRIME either in Step 4 or Step 6.It returns PRIME either in Step 4 or Step 6.
Correctness (1)Correctness (1)
Lemma. If the algorithm returns Lemma. If the algorithm returns PRIME, n is prime. PRIME, n is prime.
If it returns PRIME in Step 4 then If it returns PRIME in Step 4 then nn must must be prime.be prime. ∵∵nn ≦ ≦ rr , and ( , and (nn, , aa) = 1 or ) = 1 or nn aa ≦ ≦ rr
The remaining case: It returns The remaining case: It returns PRIME in Step 6.PRIME in Step 6.
(n, 1) = 1(n, 2) = 1…(n, n -1) = 1(n, n) = n
Correctness (2)Correctness (2)
Find an appropriate Find an appropriate rr in Step 2. in Step 2. Lemma. There exist an r ≦ Lemma. There exist an r ≦ 16lg16lg55nn s.t. s.t.
oorr(n) > 4lg(n) > 4lg22nn pf.pf. Let Let rr11, , rr22, …, , …, rrtt be all numbers s.t. be all numbers s.t. oorrii((nn) ≦ 4lg) ≦ 4lg22
nn, note that t ≦ , note that t ≦ 16lg16lg55nn
n
i
nnii nnr
2
54lg4
1
lg16lg16 2)1(|
Let ori(n) = k nk≡1 (mod ri) ri | nk - 1
< n1n2…n4lg2n = n8lg4n+2lg2n < n16lg4n
∵n 2≦ lgn
1 2 3 16lg16lg55nn
r1 r2 rt
Correctness (3)Correctness (3)
lcm (r1, …, rt) |Π (ni - 1) < 216lg5n
However, lcm (1, …, 16lg5n) > 216lg5n
Therefore, t < 216lg5n
r {ri | 0 ≦ i ≦ t}, but r < 16lg5n, and or(n) > 4lg2n
Lemma. lcm (1, 2, …, m) 2≧ m for m>6
Correctness (4)Correctness (4)
Assume Assume nn is composite. Let is composite. Let pp be prime a be prime and nd pp | | nn pp > > rr We fix We fix pp and and rr in the remainder sections. in the remainder sections. Set Set ll = = ((XX + + aa))nn ≡ ≡ XXnn + + aa (mod (mod XXrr - 1, - 1, nn) for 1≦ ) for 1≦ aa ≦ ≦ ll ((XX + + aa))nn ≡ ≡ XXnn + + aa (mod (mod XXrr - 1, - 1, pp)) for 1≦ for 1≦ aa ≦ ≦ ll ((XX + + aa))pp ≡ ≡ XXpp + + aa (mod (mod XXrr - 1, - 1, pp)) for 1≦ for 1≦ aa ≦ ≦ ll
∵∵pp is prime and ( is prime and (aa, , pp) = 1 ) = 1
nr lg)(2
Correctness (5)Correctness (5)
Definition. For polynomial Definition. For polynomial ff((XX) and number ) and number mm NN, we say that , we say that mm is is introspectiveintrospective for for ff((XX) if) if
[[ff((XX)])]mm ≡ ≡ ff((XXmm) (mod ) (mod XXrr – 1, – 1, pp)) nn, , pp are are introspectiveintrospective for for ff((XX) = ) = XX + + aa Lemma. If m and m’ are introspective numbLemma. If m and m’ are introspective numb
ers for f(X) then so is m × m’ers for f(X) then so is m × m’ pf.pf.
[[ff((XX)])]mmmm’’ ≡ [ ≡ [ff((XXmm)])]mm’’ (mod (mod XXr r - 1, - 1, pp))Let Let YY = = XXmm, [, [ff((YY)])]mm’’, [, [ff((YY)])]mm’’ ≡ ≡ ff((YYmm’’) (mod ) (mod YYrr - 1, - 1, pp))
[[ff((XXmm)])]mm’’ ≡ ≡ ff((XXmmmm’’) (mod ) (mod XXrr - 1, - 1, pp)) [[ff((XX)])]mmmm’’ ≡ ≡ ff((XXmmmm’’) (mod ) (mod XXr r - 1, - 1, pp)) Yr - 1 = Xmr - 1
Xr - 1 | Xmr – 1
Correctness (6)Correctness (6)
Lemma. If m is introspective for f(X) and Lemma. If m is introspective for f(X) and g(X) then so is f(X)g(X)g(X) then so is f(X)g(X)
pf.pf.claim: [claim: [ff((XX))gg((XX)])]mm ≡ ≡ ff((XXmm))gg((XXmm) (mod ) (mod XXrr – 1, – 1,
pp)) [[ff((XX)])]mm ≡ ≡ ff((XXmm) (mod ) (mod XXrr – 1, – 1, pp)) [[gg((XX)])]mm ≡ ≡ gg((XXmm) (mod ) (mod XXrr – 1, – 1, pp))
[[ff((XX)])]mm[[gg((XX)])]mm ≡ ≡ ff((XXmm))gg((XXmm) (mod ) (mod XXrr – 1, – 1, pp))
Lemma 4.5. If Lemma 4.5. If mm and and mm are are introspectiintrospectiveve numbers for numbers for ff((xx)) then so is then so is mm m m..
Lemma 4.6. If Lemma 4.6. If mm is introspective for is introspective for ff((xx)) and and gg((xx)) then it is also introspective for then it is also introspective for ff((xx) ) gg((xx))..
SetSet
Lemma 4.5 and 4.6 implies that every Lemma 4.5 and 4.6 implies that every number in the set number in the set II is instropective for is instropective for every polynomials in the set every polynomials in the set PP..i,e,i,e,
l
a
e
ji
eaxP
jipnI
1 0 |
, 0,|
)()(
)(,Let mm xfxf
PxfIm
Define Define GG be the set of all residues of numberbe the set of all residues of numbers ins in II modulomodulo rr , , thenthen G G is a subgroupis a subgroup of of
Let |G| = t , Let |G| = t , and sinceand since o orr((nn) > 4log) > 4log22nn, ,
t > 4logt > 4log22n.n.
1),(|][ * raZaZ rr
Gaurua
vraurvauvu
rasorprn
G
Ipnpnpnpf tjsitsji
1
1-
) (mod 1]][[
)(1 , 1s.t ,
1),( , 1),(),(
a claim G, a 2.
)())(( close 1.
tnorbn
rbnGbIntt |)( so ), (mod
) (mod s.t and Let
Lemma 4.7.Lemma 4.7.
1
2||
t
lt
latpotax
pxhP
l
il
riti 1 ,0 ),( |)(
. and )( modulo in
spolynomial of residues zero-non all ofset thebe Let
1aa1
))...()2(1)( of nscombinatio (the .in degree
of spolynomaildistinct 1
2least at exist thereTherefore,
F.in )( )( Thus,
tion)constradic ( . than less is
)( of degree thehowever, F,in )( of rootsdistinct |G| has
Gm, )(-)((x) polynomial theofroot a is x
)1 (mod )()()]([)]([ Let
F.in )( )( and )()( Assume
.in elementsdifferent tomap will
in than less degree of polynomialdistinct any two : Claim
2
m
m
1 lttt
rmmm
lxxxt
t-
l-t
xgxf
t
xQxQG
xgxfQ
,pxxgxfxgxf Im
xgxfPx, gxf
Pt
pf
Lemma 4.8. If n is not a power of p,Lemma 4.8. If n is not a power of p,
thenthen tn22/1||
)2/(2
1)( is (Y) of degree The
F.in rootsdistinct ||least at has (Y) ,
Fin (Y) ofroot a is )( then ,Y (Y)
),1 (mod )]([
),1 (mod )(
),1 (mod )( )]([
thenP, )(
),1 (mod
) ( . modulo equal bemust , numbers least twoat , |G| Since
numbers.distinct )1( has set then the ofpower anot is If
,0|
21
m
2m
mm
2
2121
2
21
2
11
1
npnnpmQ
QSo
QxfYQLet
pxxf
pxxf
pxxfxf
xfLet
pxxx
mmrImmt
ttIpn
tjipnIDefine
tt
m
rm
r
r
rmm
ji
Lemma 4.9. If the algorithm returns Lemma 4.9. If the algorithm returns PRIME then n is prime.PRIME then n is prime.
t
nt
n
nn
nnlnt
nt
ntnt
ntl
t
lt
nrlt
pf
2
log2
2
1
1logt2logt2 since 2
) logt2log(r)2 since( log2
1log22
logt2 since log2
log21-
1-
2- ||
log)(2 and |G| for that
implies 4.7. Lemma PRIME. returns algorithm that theSuppose
) 412(22)1
)(12
(1)....1(
)....22)(12(
12 2
nifn
n
n
nn
nnn
n
n nn
. Therefore, 1. stepin COMPOSITEreturn will
algorithm then the1 If 0.k somefor Therefore,
p. ofpower anot isn if 2
1 || 4.8, lemmaBy 2
pn
k pn
n
k
t
O(log3n)O(log7n)
(log5n r’s)O(rlogn)= O(log6n)
Each equation : O(rlog2n)Total : O(log10.5n)