|
|
|
|
Lucas-Lehmer Primality Test
A Mersenne number, Mn is a number of the form 2n - 1. If the exponent n is prime, there is a chance that Mn is prime. Let Ln be defined recursively by L0 = 4 and Ln+1 = Ln2 - 2. [Lucas-Lehmer, 1930] The following two statements are equivalent for Mersenne numbers:
The Lucas-Lehmer test provides a definitive test that Mn is prime or not prime based on a deterministic calculation. This page shows a proof of the Lucas-Lehmer test. Another web page ( http://www.utm.edu/research/primes/notes/proofs/LucasLehmer.html) shows one direction (Mp divides Lp-1 implies that Mp is prime). Understanding this page helped develop an approach to the rest of the proof. For completeness, the entire proof is shown here and the overlap is presented slightly differently. From a purely logical perspective, the equivalence is needed or there might be Mersenne primes missed by the test.The Lucas-Lehmer test is the mathematical basis for the GIMPS distributed processing project initiated by George Woltman. The computation in the GIMPS software bears no relation to the proof of the Lucas-Lehmer (LL) test, however, because the LL test requires that a (long) repetitive process of squaring and subracting 2 modulo Q be conducted accurately. George recognized that large integer multiplication can be done with discrete Fourier transforms allowing him to write a program to calculate Lp-1 modulo Q. His work has led to the discovery of several new Mersenne primes and testing of thousands of Mersenne numbers over the past several years. The GIMPS freeware is a very nice way to use the otherwise wasted time on your computers. You can also get involved in interesting discussions of computing and occasionally number theory. Start with http://www.mersenne.org or http://www.entropia.com/primenet/status.shtml. For pennies a year, you can contribute to productive mathematical research.
PROOF of Lucas-Lehmer. Many steps in the proof rely on facts about congruence, finite fields and finite groups. Standard facts of number theory will be assumed in this page. I hope to add additional pages to show proofs or development of these "standard facts" because they are standard only to folks who have had a fair amount of abstract algebra or number theory. Also, this proof is simply "my" proof written for my personal satisfaction. There may well be one or more better proofs in the literature. If you know of one, please feel free to inform me of it (as well as of any errors you may find in this proof!) and if you have a URL, I hope you can share that as well. Standard Facts. (This collection of definitions and theorems may be expanded depending on feedback.)
Part 1. [(1) implies (2)] If Mp divides Lp-1, then Mp is prime.
[Proof follows http://www.utm.edu/research/primes/notes/proofs/LucasLehmer.html which credits two articles; find "Bruce93" for the full citation at http://www.utm.edu/research/primes/refs.shtml.]
Let v = 2 + 31/2 and u = 2 - 31/2. Then u+v = 4 = L0 and uv = 1. An inductive argument shows: Ln = u t(n-1) + v t(n-1) with t(s) = 2s. t(s) has the obvious properties t(0) = 1 and t(s+1) = 2 t(s). (Note: this exponential function is introduced only because HTML does not seem to like superscripts on superscripts. Also, 31/2 is used for the square root of 3 because there does not appear to be a square root symbol which displays properly. ) Since T(0) = 1, and L0 = u t(0) + v t(0), we have the start of the argument. Assume the formula works for Ln. Then Ln2 - 2 = [u t(n-1) + v t(n-1) ]2 - 2 = u 2 t(n-1) + v 2 t(n-1) + 2 u t(n-1) v t(n-1) - 2 = u t(n) + v t(n) = Ln+1 as required.
Now suppose that Lp-1 is divisible by Q = Mp = 2p - 1 but Q is not prime. We will show a contradiction which shows that "Q not prime" is false so Q is prime. Let r be prime dividing Q with r < Q1/2. Then Lp-1 is divisible by r. We now pass to working modulo r and view all of the work in the field of (Z/rZ)(31/2) or Fr(31/2) which contains Fr. This last inclusion is an equality if 3 is a square mod r. The size of this field is either r or r2 and non-zero elements have an size one less. That is, if x is non-zero in the field then there is a smallest positive number d with xd = 1. The number d is called the order of x and must divide r-1 or r2 -1 (since r-1 divides r2 -1 we can ignore r-1 and not worry about whether 3 is a square or not). Lp-1 is divisible by r, so mod r, Lp-1 = 0. That is, Lp-1 = u t(p-2) + v t(p-2) = u t(p-2) ( 1 + v 2 t(p-2) ) = 0.
Now, u is not 0. (Otherwise, we would have 3 = 4 mod r which is impossible unless r = 1.) Thus 0 = 1 + v 2 t(p-2) = 1 + vt(p-1) and vt(p-1) = -1. Squaring, vt(p) = 1 and the order of v must divide t(p). Now, t(p) is a power of two so any number less than t(p) that divides t(p) will also divide t(p-1). If the order of v is less than t(p), then we would have vt(p-1) = 1 and not -1. Thus, the order of v is t(p). Now, t(p) = 2p = Q + 1 and t(p) divides r2 -1. We now have the inequalities: Q+1 = t(p) = 2p < r2 -1 < Q - 1 since r < Q1/2 from the start. This gives us the needed contradiction.
Part 2. [(2) implies (1)] If Mp is prime, then Mp divides Lp-1.
Again using Q = Mp = 2p - 1 and other notation from Part 1, we must show vt(p-1) = -1 mod Q. This will establish that Lp-1 = u t(p-2) + v t(p-2) = u t(p-2) ( 1 + v 2 t(p-2) ) = 0 mod Q. There are several components to this part of the proof. In FQ. or the usual integers mod Q:
This last means that FQ (31/2) has Q2 elements of the form a + b 31/2 with a and b in FQ. In this characterization, 31/2 is taken as either one of the roots of the equation x2 = 3 over FQ. We could use some other symbol, of course, but there seem to be enough symbols already. The real numbers v and u have images in FQ (31/2) given by 2+ 31/2 and 2- 31/2. These images also satisfy u+v=4 and uv=1. We then have vQ = 2Q +(31/2)Q = 2 + 3(Q-1)/2 31/2. Now 3 is not a square mod Q and (3(Q-1)/2)2 = 3(Q-1) = 1, so we must have 3(Q-1)/2 = -1. Thus, vQ = 2 + 3(Q-1)/2 31/2 = 2 - 31/2 = u. Also, vQ+1 = uv = 1. Examining the orders of elements in FQ (31/2), we see that the order divides Q2 - 1 = (Q-1)(Q+1) = [(Q-1)/2] 2p+1. Note that (Q-1)/2 is odd and the order of v is a power of 2 dividing Q+1. We can exhibit an element of FQ (31/2) which is a square root of v but has no square root itself. This will give us an element of the field with order 2(Q+1) and show that v has order Q+1. This in turn means that v(Q+1)/2 = vt(p-1) = -1 which will complete this part of the proof. The details supporting this outline follow.
Work in FQ (that is, integers mod Q): The non-zero elements of FQ form a cyclic group of order Q-1. (This is one of those standard facts from number theory.) That is, there are numbers g such that powers of g from 0 to Q-2 cover all of the non-zero elements of FQ. For example, mod 31 there are 8 choices for a generator: 3, 11, 12, 13, 17, 21, 22, 24.
We need some information about squares and non-squares mod Q (or really mod any prime). We will use some properties related to the "Law of Quadratic Reciprocity," but we do not need the full theorem and we can develop what we need. A non-zero element, a, of FQ is a square if there is an element x in FQ with x2 = a. Since 2 divides Q-1, we can simply look at a(Q-1)/2 which is +1 if a is a square or -1 if a is not a square. Also, given a and b non-zero in FQ, we see that (ab)(Q-1)/2 = a(Q-1)/2 b(Q-1)/2 so we have several useful properties of squares immediately to hand: the product of any two non-squares is a square and the product of any square and a non-square is a non-square. -1 is not a square: Notice that Q-1 is divisible by 2 but not 4. This means that (Q-1)/2 is odd and (-1)(Q-1)/2 = -1 or -1 is not a square.
2 is a square (and a fourth power): From the "Little Fermat" Theorem, 2Q = 2, so 2Q+1 = 4 and Q+1 is a power of 2 (in fact, at least 8 = 7 + 1). Then, 21/2 = 2(Q+1)/4 and 21/4 = 2(Q+1)/8.
3 is not a square: Note that one of the three integers Q-1, Q and Q+1 must be divisible by 3. Q is prime and Q+1 is a power of 2, so 3 must divide Q-1. Let g be a generator of the group of non-zero elements of FQ under multiplication. This group is cyclic and has Q-1 elements. Let g be a generator, then w = g(Q-1)/3 is a non-trivial cube root of 1. That is, there is an integer w which satisfies (mod Q, of course) w3 - 1 = 0 or w2 + w + 1 = 0. For example, mod 31, the non-trivial cube roots of 1 are 5 and 25 (or -6). Consider z = w - w2. This z (an integer mod Q) has a remarkable square: z2 = ( w - w2 )2 = w2 - 2w3 + w4 = w2 - 2 + w = -3 because w2 + w = -1. This calculation is the simplest case of one approach to proving the general law of Quadratic Reciprocity. Thus -3 is a square and -1 is not a square, so 3 is not a square because 3 = (-1)(-1) 3 = (-1)(-3). Work in FQ(31/2) or numbers of the form a+b 31/2, viewed mod Q In any field of prime characteristic Q, we have (x+y) Q = x Q + y Q. This follows from the Binomial theorem and the fact that the binomial coefficients (other than 0 and Q terms) are all divisible by Q.
v = 2 + 31/2 has a square root but no 4th root: Now that we have 3 is not a square mod Q, we know that 3(Q-1)/2 = -1. This gives us vQ = 2 + 3(Q-1)/2 31/2 = 2 - 31/2 = u. Also, v has a fairly simple square root. The process of determining that v has no 4th root is quite similar to finding the square root, so we will just observe that (1+ 31/2 )/ 21/2 is a square root of v. By 1/ 21/2 we mean any square root of 1/2. One such is 1/2(Q+1)/4 = 2 Q-1 - (Q+1)/4. Since 2 also has a 4th root, so does 1/2 and v has a 4th root if (1+ 31/2 ) is a square. If (1+ 31/2) is a square, there must be integers a and b with (a+b 31/2) 2 = 1+ 31/2. Expanding, (a+b 31/2) 2 = a 2 + 3b2 + 2`ab 31/2 = 1 + 31/2. From this, a 2 + 3b2 = 1 and 2ab = 1. It is enough now to notice that 2ab = a 2 + 3b2. Rearranging, we have 0 = a 2 - 2ab + 3b2 = (a-b) 2 + 2b2. Solving for -2, we have -2 = (a-b)2 /b2 = [(a -b)/b]2. In order to find a and b, -2 must be a square. However, 2 is a square and -1 is not a square so -2 is not a square and there are no such a and b. Thus we have no 4th root for v. This completes Part 2. |
|
Send mail to jt@jt-actuary.com with questions or comments about this web site.
|