Primality Test: Rabin Miller vs AKS
-
Upload
bruno-neto -
Category
Documents
-
view
46 -
download
0
description
Transcript of Primality Test: Rabin Miller vs AKS
-
PrimalityTesting:
Rabin-Millervs AKS
Bruno Neto
PrimalityTestProbabilisticvsDeterministicHistory ofPrimalityTesting
Rabin-MillerPrimalityTestFermatsPrimality TestRabin-Miller
AKSPrimalityTestFactsAlgorithm
References
Primality Testing:Rabin-Miller vs AKS
Author: Bruno NetoInstructor: Dr. George Steele
PMAT 427 - Number TheoryWinter 2014
University of Calgary
April 9th, 2014
-
PrimalityTesting:
Rabin-Millervs AKS
Bruno Neto
PrimalityTestProbabilisticvsDeterministicHistory ofPrimalityTesting
Rabin-MillerPrimalityTestFermatsPrimality TestRabin-Miller
AKSPrimalityTestFactsAlgorithm
References
Table of Contents
1 Primality TestProbabilistic vs DeterministicHistory of Primality Testing
2 Rabin-Miller Primality TestFermats Primality TestRabin-Miller
3 AKS Primality TestFactsAlgorithm
4 References
-
PrimalityTesting:
Rabin-Millervs AKS
Bruno Neto
PrimalityTestProbabilisticvsDeterministicHistory ofPrimalityTesting
Rabin-MillerPrimalityTestFermatsPrimality TestRabin-Miller
AKSPrimalityTestFactsAlgorithm
References
Primality Test
Goal
The goal of a primality test algorithm is to verify whether agiven positive integer is prime or not.
Gauss, disquisitiones arithmeticae, 1801
"The problem of distinguishing prime numbers from compositenumbers and of resolving the latter into their prime factors isknow to be one of the most important and useful inarithmetic(...) Nevertheless, we must confess that all methodsthat have been proposed thus far are either restricted to veryspecial cases or are so laborious and prolix that (...) thesesmethods do not apply at all to large numbers. "
-
PrimalityTesting:
Rabin-Millervs AKS
Bruno Neto
PrimalityTestProbabilisticvsDeterministicHistory ofPrimalityTesting
Rabin-MillerPrimalityTestFermatsPrimality TestRabin-Miller
AKSPrimalityTestFactsAlgorithm
References
Probabilistic vs Deterministic
Probabilistic (or Randonmized) Test
Give a positive integerCheck for a random a if it worksRepeat k timesResult: Maybe prime
Ex: Fermat, Rabin-Miller, RSA, Solovay-Strassen
-
PrimalityTesting:
Rabin-Millervs AKS
Bruno Neto
PrimalityTestProbabilisticvsDeterministicHistory ofPrimalityTesting
Rabin-MillerPrimalityTestFermatsPrimality TestRabin-Miller
AKSPrimalityTestFactsAlgorithm
References
Probabilistic vs Deterministic
Deterministic Test
Give a positive integerTest the algorithmResult: Guaranteed whether prime or composite
Ex: Trial Division, AKS, Elliptic Curve, "Rabin-Miller"
-
PrimalityTesting:
Rabin-Millervs AKS
Bruno Neto
PrimalityTestProbabilisticvsDeterministicHistory ofPrimalityTesting
Rabin-MillerPrimalityTestFermatsPrimality TestRabin-Miller
AKSPrimalityTestFactsAlgorithm
References
History of Primality Testing
In 17th Century, Fermats Little Theorem says for anyprime integer n and any integer a coprime to n,an1 1(mod n)1976 - Miller used the alternative property to obtain adeterministic polynomial time1980 - Rabin modified Milles test to a randomizedpolynomial time algorithm1984 - Adleman, Pomerance, and Rumely created adeterministic for primality test that runs in(log(n))O(log log log(n)) time1986 - Goldwasser and Kilian proposed a randomizedalgorithm based on Elliptic Curves running in expectedpolynomial time2002 - Agrawal, Kayal, and Saxena proved a deterministicalgorithm in polynomial time
-
PrimalityTesting:
Rabin-Millervs AKS
Bruno Neto
PrimalityTestProbabilisticvsDeterministicHistory ofPrimalityTesting
Rabin-MillerPrimalityTestFermatsPrimality TestRabin-Miller
AKSPrimalityTestFactsAlgorithm
References
Fermats Primality Test
Fermats Little Theorem
If n is prime and (a, n) = 1, then an1 1(mod n).
Alternative Statement 1
If an1 6 1(mod n) and (a, n) = 1, then n is definitelycomposite.
Alternative Statement 2
If an1 1(mod n) and (a, n) = 1, then n is probably prime.
-
PrimalityTesting:
Rabin-Millervs AKS
Bruno Neto
PrimalityTestProbabilisticvsDeterministicHistory ofPrimalityTesting
Rabin-MillerPrimalityTestFermatsPrimality TestRabin-Miller
AKSPrimalityTestFactsAlgorithm
References
Examples
base 2, 3 < n < 1000
2340 1(mod 341), however 341 = 11 x 312560 1(mod 561), however 561 = 3 x 11 x 172645 1(mod 645), however 645 = 3 x 5 x 43
base 5, 3 < n < 1000
53 1(mod 4), however 4 is composite5123 1(mod 124), however 124 = 4 x 315560 1(mod 561), however 561 is composite5780 1(mod 781), however 781 = 11 x 71
Fermats Pseudoprimes
341, 561 in base 2 and 4, 124, 561, 781 in base 5
-
PrimalityTesting:
Rabin-Millervs AKS
Bruno Neto
PrimalityTestProbabilisticvsDeterministicHistory ofPrimalityTesting
Rabin-MillerPrimalityTestFermatsPrimality TestRabin-Miller
AKSPrimalityTestFactsAlgorithm
References
Carmichael Numbers
Carmichael Numbers less then 10,000
561, 1105, 1729, 2465, 2821, 6601, 8911
Theorem(Erdos)
Theorem: Let C (X ) be the number of Carmichael numbersless then X, then
C (X ) < Xexp
(k2log(x)logloglog(X )loglog(X )
)
C (103) = 1
C (1010) = 1547
-
PrimalityTesting:
Rabin-Millervs AKS
Bruno Neto
PrimalityTestProbabilisticvsDeterministicHistory ofPrimalityTesting
Rabin-MillerPrimalityTestFermatsPrimality TestRabin-Miller
AKSPrimalityTestFactsAlgorithm
References
History of Rabin-Miller Primality Test
Gary G. Miller is a professor at Carnegie Mellon University andcreated the algorithm deterministically assuming theGeneralized Riemann Hypothesis in 1976. While Michael O.Rabin, based his method to test the algorithm probabilisticallyusing Millers work in 1980.
-
PrimalityTesting:
Rabin-Millervs AKS
Bruno Neto
PrimalityTestProbabilisticvsDeterministicHistory ofPrimalityTesting
Rabin-MillerPrimalityTestFermatsPrimality TestRabin-Miller
AKSPrimalityTestFactsAlgorithm
References
Algorithm
Rabin-Miller Algorithm
1 Input: n odd, k repetitions2 make n 1 = 2sm, m odd and s biggest power of 23 for i in range(1,k)4 a = random [2, n-1]5 while s > 06 If a2
sm 1(mod n), then n is composite7 If a2
sm 1(mod n), then n is probably a prime8 s = s 19 Output: n definitely composite or n probably prime
-
PrimalityTesting:
Rabin-Millervs AKS
Bruno Neto
PrimalityTestProbabilisticvsDeterministicHistory ofPrimalityTesting
Rabin-MillerPrimalityTestFermatsPrimality TestRabin-Miller
AKSPrimalityTestFactsAlgorithm
References
Example
Test, after one interation
Enter an odd integer to be tested:4547337172376300111955330758342147474062293202868155909393Enter the number of times you want to test: 1The number is probably a prime
Test, after two interations
Enter an odd integer to be tested:4547337172376300111955330758342147474062293202868155909393Enter the number of times you want to test: 2The number is definitely a composite integer.
-
PrimalityTesting:
Rabin-Millervs AKS
Bruno Neto
PrimalityTestProbabilisticvsDeterministicHistory ofPrimalityTesting
Rabin-MillerPrimalityTestFermatsPrimality TestRabin-Miller
AKSPrimalityTestFactsAlgorithm
References
Lemma 1
Lemma: Let a Z, n N, n 2, and (a, n) = 1. Then n isprime if and only if (X + a)n (X n + a) 0 (mod n)
Proof of Lemma 1
Proof: For 0 < i < n, the coefficient of x i in(X + a)n (X n + a) 0 (mod n) is (ni )an1.n prime (ni ) 0 (mod n) all the coefficients are zero.If n is composite. Consider a prime q that is a factor of n andlet qk |n. Then qk does not divide (nq) and is coprime to anqand hence the coefficient of X q is not zero (modn). Thus,((X + a)n(X n + a)) is not identically zero over Zn.
-
PrimalityTesting:
Rabin-Millervs AKS
Bruno Neto
PrimalityTestProbabilisticvsDeterministicHistory ofPrimalityTesting
Rabin-MillerPrimalityTestFermatsPrimality TestRabin-Miller
AKSPrimalityTestFactsAlgorithm
References
Algorithm
AKS psedocode Algorithm
Input: integer n > 11 If (n = ab) for a N and b > 1, output COMPOSITE2 Find the smallest r such that or (n) > log2n.3 If 1 < (a, n) < n for some a r , output COMPOSITE4 If n r , output PRIME5 For a = 1 to b(r)log(n)c do6 if((X + a)n 6 X n + a (mod X r 1, n)), output
COMPOSITE7 output PRIME
-
PrimalityTesting:
Rabin-Millervs AKS
Bruno Neto
PrimalityTestProbabilisticvsDeterministicHistory ofPrimalityTesting
Rabin-MillerPrimalityTestFermatsPrimality TestRabin-Miller
AKSPrimalityTestFactsAlgorithm
References
References
1 Agrawal, M., Kayal, N., and Saxena, N., PRIMES is in P,Kanpur-208016, India, 2002
2 Perrenoud, M., Randomized and Deterministic PrimalityTest, Ecole Polytechnique Federale de Lausanne, 2009
3 Jin, T., Research and Implementation on AKS Algorithm,University of Bath, 2005
4 Mcintosh, C., Finding Prime Numbers: Miller Rabin andBeyond, Furman University, Eletronic Journal ofUndergraduate Mathematics, Vol. 12, 1-4, 2007
-
PrimalityTesting:
Rabin-Millervs AKS
Bruno Neto
PrimalityTestProbabilisticvsDeterministicHistory ofPrimalityTesting
Rabin-MillerPrimalityTestFermatsPrimality TestRabin-Miller
AKSPrimalityTestFactsAlgorithm
References
Thank you!
Primality TestProbabilistic vs DeterministicHistory of Primality Testing
Rabin-Miller Primality TestFermat's Primality TestRabin-Miller
AKS Primality TestFactsAlgorithm
References