PRIMES is in P
Jóhann Guðmundsson Háskóli Íslands Reykjavík, nóvember 2008
PRIMES is in P Jhann Gumundsson Hskli slands Reykjavk, nvember - - PowerPoint PPT Presentation
PRIMES is in P Jhann Gumundsson Hskli slands Reykjavk, nvember 2008 Determine primality Initial guessing: Try deviding n with every number m < n , if m || n then n is composite. This is inefficient and takes ( n ) a
Jóhann Guðmundsson Háskóli Íslands Reykjavík, nóvember 2008
Initial guessing: Try deviding n with every number m < √n, if m||n then n is composite. This is inefficient and takes Ω(√n)a steps. Would prefer a polynomial number of steps in the size of the input ⌈log2 n⌉
aWhere if f(n) ∈ Ω(n) means ∃(k > 0), n0 ∈ N : ∀(n >
n0) kg(n) ≤ f(n)
1
Lemma: Let a ∈ Z, n ∈ N and (a, n) = 1. Then n is prime iff: (X + a)n = Xn + a (mod n) We also have n is prime for appropriatly chosen r and a iff (X + a)n = Xn + a (mod Xr − 1, n) (1)
2
Equation (1) reduces the number of coefficiets and therefore speeds up the calculation. Now faced with a new problem, if the equation holds n is not nececarily prime. The remedy is to choose an appropriate r and test the equation for several a’s. Then n must be a prime power.
3
Input: integer n > 1.
if ((X + a)n = Xn + a (mod Xr − 1, n)),
4
Here or(n) is the order of n wrt. r and φ(r) is Euler’s totient function, giving the number of numbers less than r, relati- vely prime to r.
5
Theorem: The asymptotic time complexity of the algo- rithm is O˜(log21/2 n), where O˜(t(n)) = O(t(n) log(t(n))c) for some constant c.
6