From M. I. Rosen, "A Proof of the Lucas-Lehmer Test," American Mathematical Monthly, 81 (1988), 855-856.


Definition. Let S1 = 1 and Sn+1 = Sn2 - 2 for n >= 1.


Lucas-Lehmer Test. Let p be a prime number. Then, Mp = 2p-1 is prime if and only if Mp divides Sp-1 .


Definitions. Let
t = (1 + sqrt(3))/ sqrt(2), u = (1 - sqrt(3))/ sqrt(2)
and
w = t2 = 2 + sqrt(3), v = u2 = 2 - sqrt(3) .

Note that tu = -1 and wv = 1.


Lemma.
Sm = w2m-1 + v2m-1 .


Proof. By induction on m.


Lemma 2. If we assume Mp is prime, then tMp + 1 = -1 (mod Mp) .


Proof. The congruence is understood to take place in the ring of algebraic integers. We temporarily set q = Mp.


Write sqrt(2) t = 1 + sqrt(3), raise both sides to the qth power and take congruences modulo q. We find


tq w(q-1)/2 sqrt(2) = 1 + 3(q-1)/2 sqrt(3) (mod q) .

Since q = -1 (mod 8) we have

2(q-1)/2 = (2/q) = 1 (mod q) .

Since q = 1 (mod 3) we have

3(q-1)/2 = (3/q) = -1 (mod q) .

It follows that

tq = u (mod q) and tq+1 = tu = -1 (mod q) .

We can now prove the theorem. We first prove that
Sp-1 = 0 (mod Mp) implies Mp is prime.
This part of the proof makes no use of Lemma 2. From the condition Sp-1 = 0 (mod Mp) we find
w2p-2 + v2p-2 = 0 (mod Mp)
so that
w2p-1 = -1 (mod Mp) and v 2p = 1 (mod Mp) .
Let l be a prime dividing Mp, and O = Z[ sqrt(3) ]. The coset of w in (O/lO)* has order 2p by the above congruences. Suppose l splits in O. Then it follows that
(O/lO)* = (Z/lZ)* x (Z/lZ)* ,
and so 2p divides l-1. Thus, l = 1 + 2pk for some k >= 1. This is impossible because it implies
l >= 1 + 2p > Mp .
Suppose l stays prime in O. Then (O/lO)* has order l2 - 1 and 2p divides l2 - 1 = (l-1)(l+1). If l = 1 (mod 4) we must have 2p-1 divides l-1, or l = 1 + 2p-1 k for some k >= 1. This cannot happen since 2l >= 2 + 2p > Mp. If l = 3 (mod 4), then 2p-1 divides l+1 so that l = -1 + 2p-1 k for some k >= 1. One cannot have k = 1 since 2p-1 - 1 does not divide 2p - 1. The only possible case is k=2. Then, l = 2p - 1 = Mp, and so Mp is prime. Finally, suppose Mp is prime. From Lemma 2 we have
tM + 1 = -1 (mod Mp) or t2p + 1 = 0 (mod Mp).
Since t2 = w, w2p-1 + 1 = 0 (mod Mp ). Multiply both sides of this congruence with v2p-2 and recall wv = 1. The result is
Sp-1 = w2p-2 + v2p-2 = 0 (mod Mp) .