proof of Lucas-Lehmer primality test
The objective of this article is to prove the Lucas-Lehmer primality test:
Let be a prime, and let be the corresponding Mersenne number. Then is prime if and only if divides (equivalently, if and only if ) where the numbers are given by the following recurrence relation:
We show that the validity of the primality test is equivalent to the following theorem, which is then proved directly:
Theorem 1.
(Lucas) is prime if and only if , where .
To see that the two are in fact equivalent, let . Then . Thus
Note that . Then
It thus remains to prove Theorem 1. We start with two simple lemmas:
Lemma 2.
If is prime, then or .
Proof.
where is the Legendre symbol. Thus
∎
Lemma 3.
Let be a prime with and . Then .
Proof.
, so that
But , so that . Thus and therefore
Also,
But , so and thus
Putting together the two expressions for , we get .∎
We are now in a position to prove Theorem 1:
Proof.
If is prime where is prime, then note that so that satisfies the conditions of Lemma 3. The result follows.
If , choose for a prime. Since , we have . Since also and thus . But , so
Thus the order of divides . It can’t divide since , so its order is precisely . However, or by Lemma 2 and thus . But , so and is in fact prime.∎