Prime Numbers

Prime Numbers Prime Numbers

thales.doa.fmph.uniba.sk
from thales.doa.fmph.uniba.sk More from this publisher
10.12.2012 Views

212 Chapter 4 PRIMALITY PROVING But if kB and d is an integer with d>(ln n) 1.84 , then there is a squarefree number D in the interval [d, 4d] such that each prime factor q of D satisfies (1) q

4.5 The primality test of Agrawal, Kayal, and Saxena (AKS test) 213 4.5.4 A quartic time primality test Since the most time-consuming step of Algorithm 4.5.1 is the checking of the congruence (x + a) n ≡ x n + a (mod x r − 1,n) for so many values of a, this area would be a good place to look for improvements. In Theorem 4.5.4 we had the improvement of replacing x r − 1 with a polynomial f(x) of possibly smaller degree. Another idea is to get binomial congruences verified “for free.” In the following theorem, we replace x r − 1withx r − b for a suitable integer b, and we need only verify one binomial congruence. Theorem 4.5.7. Let n, r, b be integers with n > 1, r|n − 1, r > lg 2 n, b n−1 ≡ 1(modn), andgcd(b (n−1)/q − 1,n)=1for each prime q|r. If then n is a prime or prime power. (x − 1) n ≡ x n − 1(modx r − b, n), (4.30) Proof. Let p|n be prime and set A = b (n−1)/r mod p. ThenA has order r in Z ∗ p, so that in particular, r|p − 1 (see Pocklington’s Theorem 4.1.3). Note that Thus, by our hypothesis, x n = x · x n−1 = x(x r ) (n−1)/r ≡ Ax (mod x r − b, p). (4.31) (x − 1) n ≡ x n − 1 ≡ Ax − 1(modx r − b, p). Also note that if f(x) ≡ g(x) (modx r − b, p), then f(A i x) ≡ g(A i x) (mod x r − b, p) for any integer i, since(A i x) r − b ≡ x r − b (mod p). Thus, taking f(x) =(x − 1) n and g(x) =Ax − 1, we have (x − 1) n2 ≡ (Ax − 1) n ≡ A 2 x − 1(modx r − b, p), and more generally by induction, we get (x − 1) nj ≡ A j x − 1(modx r − b, p) (4.32) for every nonnegative integer j. Note that if c is an integer and c r ≡ 1(modp), then c ≡ A k (mod p) for some integer k; indeed, all that is used for this observation is that p is prime and A has order r modulo p. So,wehave x p = x · x p−1 = x(x r ) (p−1)/r ≡ b (p−1)/r x ≡ A k x (mod x r − b, p) for some integer k. Thus, since (Ak ) p ≡ Ak (mod p), we have by induction that x pi ≡ A ik x (mod x r − b, p) (4.33) for every nonnegative integer i. Wehavef(x) pi Zp[x], so that by (4.32) and (4.33), we have = f(xpi) for every f(x) ∈ (x − 1) pin j ≡ (A j x − 1) pi ≡ A j x pi − 1 ≡ A j+ik x − 1(modx r − b, p)

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

4.5.4 A quartic time primality test<br />

Since the most time-consuming step of Algorithm 4.5.1 is the checking of the<br />

congruence (x + a) n ≡ x n + a (mod x r − 1,n) for so many values of a, this<br />

area would be a good place to look for improvements. In Theorem 4.5.4 we<br />

had the improvement of replacing x r − 1 with a polynomial f(x) of possibly<br />

smaller degree. Another idea is to get binomial congruences verified “for free.”<br />

In the following theorem, we replace x r − 1withx r − b for a suitable integer<br />

b, and we need only verify one binomial congruence.<br />

Theorem 4.5.7. Let n, r, b be integers with n > 1, r|n − 1, r > lg 2 n,<br />

b n−1 ≡ 1(modn), andgcd(b (n−1)/q − 1,n)=1for each prime q|r. If<br />

then n is a prime or prime power.<br />

(x − 1) n ≡ x n − 1(modx r − b, n), (4.30)<br />

Proof. Let p|n be prime and set A = b (n−1)/r mod p. ThenA has order r in<br />

Z ∗ p, so that in particular, r|p − 1 (see Pocklington’s Theorem 4.1.3). Note that<br />

Thus, by our hypothesis,<br />

x n = x · x n−1 = x(x r ) (n−1)/r ≡ Ax (mod x r − b, p). (4.31)<br />

(x − 1) n ≡ x n − 1 ≡ Ax − 1(modx r − b, p).<br />

Also note that if f(x) ≡ g(x) (modx r − b, p), then f(A i x) ≡ g(A i x)<br />

(mod x r − b, p) for any integer i, since(A i x) r − b ≡ x r − b (mod p). Thus,<br />

taking f(x) =(x − 1) n and g(x) =Ax − 1, we have<br />

(x − 1) n2<br />

≡ (Ax − 1) n ≡ A 2 x − 1(modx r − b, p),<br />

and more generally by induction, we get<br />

(x − 1) nj<br />

≡ A j x − 1(modx r − b, p) (4.32)<br />

for every nonnegative integer j.<br />

Note that if c is an integer and c r ≡ 1(modp), then c ≡ A k (mod p) for<br />

some integer k; indeed, all that is used for this observation is that p is prime<br />

and A has order r modulo p. So,wehave<br />

x p = x · x p−1 = x(x r ) (p−1)/r ≡ b (p−1)/r x ≡ A k x (mod x r − b, p)<br />

for some integer k. Thus, since (Ak ) p ≡ Ak (mod p), we have by induction<br />

that<br />

x pi<br />

≡ A ik x (mod x r − b, p) (4.33)<br />

for every nonnegative integer i. Wehavef(x) pi<br />

Zp[x], so that by (4.32) and (4.33), we have<br />

= f(xpi) for every f(x) ∈<br />

(x − 1) pin j<br />

≡ (A j x − 1) pi<br />

≡ A j x pi<br />

− 1 ≡ A j+ik x − 1(modx r − b, p)

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

Saved successfully!

Ooh no, something went wrong!