10.12.2012 Views

Prime Numbers

Prime Numbers

Prime Numbers

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.5 The primality test of Agrawal, Kayal, and Saxena (AKS test) 201<br />

it is remarkable in that the test itself is quite simple. And further, two of<br />

the authors, Kayal and Saxena, had worked on this problem for their senior<br />

project, having just received their bachelor’s degrees three months before the<br />

announcement. A short time later, after suggestions from various quarters,<br />

Agrawal,Kayal,andSaxenacameoutwithanevensimplerversionofthe<br />

test. These two versions may be found in [Agrawal et al. 2002], [Agrawal et al.<br />

2004].<br />

In this section we shall present the second version of the Agrawal–Kayal–<br />

Saxena algorithm, as well as some more recent developments. As of this<br />

writing, it remains to be seen whether the AKS test will be useful in proving<br />

large numbers prime. The quartic time test at the end of the section stands<br />

the best chance.<br />

4.5.1 Primality testing with roots of unity<br />

If n is prime, then<br />

g(x) n ≡ g(x n )(modn),<br />

for any polynomial g(x) ∈ Z[x]. In particular,<br />

(x + a) n ≡ x n + a (mod n) (4.24)<br />

for any a ∈ Z. Further, if (4.24) holds for just one value of a with gcd(a, n) =1,<br />

then n must be prime; see Exercise 4.25. That is, (4.24) is an if-and-only-if<br />

primality criterion. The trouble is that we know no speedy way of verifying<br />

(4.24) even for the simple case a = 1; there are just too many terms on the<br />

left side of the congruence.<br />

If f(x) ∈ Z[x] is an arbitrary monic polynomial, then (4.24) implies that<br />

(x + a) n ≡ x n + a (mod f(x),n) (4.25)<br />

for every integer a. So,ifn is prime, then (4.25) holds for every integer a<br />

and every integer monic polynomial f(x). Further, it should be possible to<br />

rapidly check (4.25) if deg f(x) is not too large. As an example, take a =1<br />

and f(x) =x − 1. Then (4.25) is equivalent to<br />

2 n ≡ 2(modn),<br />

the Fermat congruence to the base 2. However, as we have seen, while this<br />

congruence is necessary for the primality of n, itisnotsufficient.So,by<br />

introducing the modulus f(x) we gain speed, but perhaps lose our primality<br />

criterion.<br />

But (4.25) allows more generality; we are not required to take f(x) of<br />

degree 1. For example, we might take f(x) = x r − 1 for some smallish<br />

number r, and so be implicitly dealing with the r-th roots of unity. Essentially,<br />

allthatneedstobedoneistochooser appropriately (but bounded by a<br />

polylogarithmic expression in n), and to verify (4.25) for every a up to a<br />

certain point (again bounded by a polylogarithmic expression in n).<br />

The new primality test is so simple and straightforward that we cannot<br />

resist stating it first as pseudocode, discussing the details only afterward.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!