10.12.2012 Views

Prime Numbers

Prime Numbers

Prime Numbers

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

174 Chapter 4 PRIMALITY PROVING<br />

Remark. The version of Theorem 4.1.1 above is due to Lehmer. Lucas had<br />

such a result where q runs through all of the proper divisors of n − 1.<br />

The hypothesis (4.1) of the Lucas theorem is not vacuous for prime numbers;<br />

such a number a is called a primitive root, and all primes have them. That is,<br />

if n is prime, the multiplicative group Z∗ n is cyclic; see Theorem 2.2.5. In fact,<br />

each prime n>200560490131 has more than n/(2 ln ln n) primitive roots in<br />

{1, 2,...,n−1}; see Exercise 4.1. (Note: The prime 200560490131 is 1 greater<br />

than the product of the first 11 primes.)<br />

A consequence is that if n>200560490131 is prime, it is easy to find<br />

a number satisfying (4.1) via a probabilistic algorithm. Just choose random<br />

integers a in the range 1 ≤ a ≤ n − 1 until a successful one is found. The<br />

expected number of trials is less than 2 ln ln n.<br />

Though we know no deterministic polynomial-time algorithm for finding a<br />

primitive root for a prime, the principal hindrance in implementing the Lucas<br />

theorem as a primality test is not the search for a primitive root a, but rather<br />

finding the complete prime factorization of n − 1. As we know, factorization is<br />

hard in practice for many numbers. But it is not hard for every number. For<br />

example, consider a search for primes that are 1 more than a power of 2. As<br />

seen in Theorem 1.3.4, such a prime must be of the form Fk =22k+1. <strong>Numbers</strong><br />

in this sequence are called Fermat numbers after Fermat, who thought they<br />

were all prime.<br />

In 1877, Pepin gave a criterion similar to the following for the primality<br />

of a Fermat number.<br />

Theorem 4.1.2 (Pepin test). For k ≥ 1, the number Fk =22k+1 is prime<br />

if and only if 3 (Fk−1)/2 ≡−1(modFk).<br />

Proof. Suppose the congruence holds. Then (4.1) holds with n = Fk, a =3,<br />

so Fk is prime by the Lucas Theorem 4.1.1. Conversely, assume Fk is prime.<br />

Since 2k is even, it follows that 22k ≡ 1 (mod 3), so that Fk ≡ 2 (mod 3). But<br />

also Fk ≡ 1 (mod 4), so the Legendre symbol <br />

3 is −1, that is, 3 is not a<br />

Fk<br />

square (mod Fk). The congruence in the theorem thus follows from Euler’s<br />

criterion (2.6). ✷<br />

Actually, Pepin gave his test with the number 5 in place of the number 3 (and<br />

with k ≥ 2). It was noticed by Proth and Lucas that one can use 3. In this<br />

regard, see [Williams 1998] and Exercise 4.5.<br />

As of this writing, the largest Fk for which the Pepin test has been used<br />

is F24. As discussed in Section 1.3.2, this number is composite, and in fact,<br />

so is every other Fermat number beyond F4 for which the character (prime or<br />

composite) has been resolved.<br />

4.1.2 Partial factorization<br />

Since the hardest step, in general, in implementing the Lucas Theorem 4.1.1<br />

as a primality test is coming up with the complete prime factorization of n−1,

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

Saved successfully!

Ooh no, something went wrong!