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.

184 Chapter 4 PRIMALITY PROVING<br />

(mod (f(x),M)) and by the Euler criterion we have 2 (M−1)/2 ≡ (2/M )=1<br />

(mod M), so<br />

Next,<br />

(x − 1) M+1 ≡ (2x) (M+1)/2 =2· 2 (M−1)/2 x (M+1)/2<br />

≡ 2x (M+1)/2 (mod (f(x),M)).<br />

(x − 1) M+1 =(x − 1)(x − 1) M ≡ (x − 1)(x M − 1) ≡ (x − 1)(3 − x)<br />

≡−2(mod(f(x),M)).<br />

Thus, x (M+1)/2 ≡−1(mod(f(x),M)); that is, x2p−1 ≡−1(mod(f(x),M)).<br />

Using our automorphism, we also have (4 − x) 2p−1 ≡−1(mod(f(x),M)), so<br />

that U2p−1 ≡ 0(modM). If U2p−2 ≡ 0(modM), then x2p−2 ≡ (4 − x) 2p−2<br />

(mod (f(x),M)), so that<br />

−1 ≡ x 2p−1<br />

≡ x 2p−2<br />

(4−x) 2p−2<br />

≡ (x(4−x)) 2p−2<br />

≡ 1 2p−2<br />

≡ 1(mod(f(x),M)),<br />

a contradiction. Since U 2 p−1 = U 2 p−2V 2 p−2, wehaveV 2 p−2 ≡ 0(modM). But<br />

we have seen that V 2 p−2 = vp−2, so the proof is complete. ✷<br />

Algorithm 4.2.7 (Lucas–Lehmer test for Mersenne primes). We are given<br />

an odd prime p. This algorithm decides whether 2 p −1 is prime (YES) or composite<br />

(NO).<br />

1. [Initialize]<br />

v =4;<br />

2. [Compute Lucas–Lehmer sequence]<br />

for(k ∈ [1,p− 2]) v =(v 2 − 2) mod (2 p − 1); // k is a dummy counter.<br />

3. [Check residue]<br />

if(v == 0) return YES; // 2 p − 1 definitely prime.<br />

return NO; // 2 p − 1 definitely composite.<br />

The celebrated Lucas–Lehmer test for Mersenne primes has achieved some<br />

notable successes, as mentioned in Chapter 1 and in the discussion surrounding<br />

Algorithm 9.5.19. Not only is the test breathtakingly simple, there are ways<br />

to perform with high efficiency the p−2 repeated squarings in Step [Compute<br />

Lucas–Lehmer sequence].<br />

4.2.2 An improved n +1 test, and a combined n 2 − 1 test<br />

As with the n − 1 test, which is useful only in the case that we have a large,<br />

fully factored divisor of n − 1, the principal hurdle in implementing the n +1<br />

test for most numbers is coming up with a large, fully factored divisor of<br />

n + 1. In this section we shall improve Theorem 4.2.3 to get a result similar<br />

to Theorem 4.1.5. That is, we shall only require the fully factored divisor of<br />

n + 1 to exceed the cube root. (Using the ideas in Theorem 4.1.6, this can be<br />

improved to the 3/10 root.) Then we shall show how fully factored divisors

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

Saved successfully!

Ooh no, something went wrong!