In the Lucas-Lehmer primality test , for any prime number , Mersenne prime is also prime if and only if for the recursive sequence , starting with .
Find the next positive integer greater than that can also be used as in the primality test.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
For any s 0 , if 4 1 s 0 2 − 1 is not a perfect square, and ( 2 1 s 0 − 1 ) 2 1 ( M − 1 ) ≡ 1 ( m o d M ) for any Mersenne prime M , and ( 2 1 s 0 + 1 ) 2 1 ( M − 1 ) ≡ − 1 ( m o d M ) for any Mersenne prime M , then s 0 can be used as a seed for the primality test in which for any prime number p > 2 , Mersenne prime M p = 2 p − 1 is also prime if and only if a p − 2 ≡ 0 ( m o d M p ) for the recursive sequence a n = a n − 1 2 − 2 , starting with a 0 = s 0 (see proof below).
Typically, the a 0 seed that is used in the Lucas-Lehmer primality test is s 0 = 4 , because:
However, there are other a 0 values that satisfy the above criteria as well. Since we know that M 3 = 2 3 − 1 = 7 is a Mersenne prime for p = 3 , then for a test to be true with a different a 0 seed we must have that a p − 2 ≡ 0 ( m o d M p ) , or in this case, a 1 ≡ 0 ( m o d 7 ) . In other words, a 0 2 − 2 must be divisible by 7 . We can numerically eliminate 5 , 6 , 7 , 8 , and 9 as possible s 0 values as none of these give an a 0 2 − 2 value that is divisible by 7 , but a 0 = 1 0 is the next possible candidate as a 0 2 − 2 = 1 0 2 − 2 = 9 8 , which is divisible by 7 .
Indeed, we find that s 0 = 1 0 also satisfies the above criteria as well:
Therefore, the next positive integer greater than 4 that can also be used as a 0 in the primality test is s 0 = 1 0 .
Prove:
For any s 0 , if 4 1 s 0 2 − 1 is not a perfect square, and ( 2 1 s 0 − 1 ) 2 1 ( M − 1 ) ≡ 1 ( m o d M ) for any Mersenne prime M , and ( 2 1 s 0 + 1 ) 2 1 ( M − 1 ) ≡ − 1 ( m o d M ) for any Mersenne prime M , then s 0 can be used as a seed for the primality test in which for any prime number p > 2 , Mersenne prime M p = 2 p − 1 is also prime if and only if s p − 2 ≡ 0 ( m o d M p ) for the recursive sequence s n = a n − 1 2 − 2 , starting with a 0 = s 0 .
Given:
4 1 s 0 2 − 1 is not a perfect square
( 2 1 s 0 − 1 ) 2 1 ( M − 1 ) ≡ 1 ( m o d M ) for any Mersenne prime M
( 2 1 s 0 + 1 ) 2 1 ( M − 1 ) ≡ − 1 ( m o d M ) for any Mersenne prime M
Definitions:
Let a = 2 1 s 0
Let b = a 2 − 1
Let u = a + b
Let u = a − b
Then u u = ( a + b ) ( a − b ) = a 2 − b = a 2 − ( a 2 − 1 ) = 1
And s n = u 2 n + u 2 n by induction:
s 0 = u 2 0 + u 2 0 = u + u = ( a + b ) + ( a − b ) = 2 a = 2 ⋅ 2 1 s 0 = s 0
Assuming s n = u 2 n + u 2 n :
s n + 1 = s n 2 − 2
s n + 1 = ( u 2 n + u 2 n ) 2 − 2
s n + 1 = u 2 ⋅ 2 n + 2 u 2 n u 2 n + u 2 ⋅ 2 n − 2
s n + 1 = u 2 n + 1 + 2 ( u u ) 2 n + u 2 n + 1 − 2
s n + 1 = u 2 n + 1 + 2 ( 1 ) 2 n + u 2 n + 1 − 2
s n + 1 = u 2 n + 1 + u 2 n + 1
Proof of Sufficiency:
Prove: If s p − 2 is divisible by 2 p − 1 , then 2 p − 1 is a prime number.
Assume s p − 2 is divisible by 2 p − 1 :
Let M = 2 p − 1
s p − 2 = k M for some integer k
u 2 p − 2 + u 2 p − 2 = k M
u 2 p − 2 = k M − u 2 p − 2
u 2 p − 2 u 2 p − 2 = k M u 2 p − 2 − u 2 p − 2 u 2 p − 2
( u 2 p − 2 ) 2 = k M u 2 p − 2 − ( u u ) 2 p − 2
u 2 p − 1 = k M u 2 p − 2 − 1
Assume that 2 p − 1 is not a prime number:
Let q be the smallest prime factor of M = 2 p − 1
M ≡ 0 ( m o d q )
u 2 p − 1 ≡ k ⋅ 0 ⋅ u 2 p − 2 − 1 ( m o d q )
u 2 p − 1 ≡ − 1 ( m o d q )
( u 2 p − 1 ) 2 ≡ ( − 1 ) 2 ( m o d q )
u 2 p ≡ 1 ( m o d q )
Since u 2 p − 1 = 1 , the order does not divide 2 p − 1 , so the order is 2 p
Let X = { n + m b ∣ n , m ∈ Z q } and X ∗ = { all elements of X except 0 }
∣ X ∣ = q 2 and ∣ X ∗ ∣ = q 2 − 1 (as long as b is not a perfect square, which is true by the given criteria of s 0 )
u is in X ∗ , and since the order of an element is at most the order of its size, 2 p ≤ q 2 − 1 < q 2
Since q is the smallest prime factor of M , q 2 < M = 2 p − 1
But then 2 p < 2 p − 1 which is a contradiction.
So 2 p − 1 must be a prime number.
Proof of Necessity:
Prove: If 2 p − 1 is a prime number, then s p − 2 is divisible by 2 p − 1 .
If 2 p − 1 is a prime number, then p must be a prime number: Assume p is not a prime number:
Then p has two factors m ≥ 2 and n ≥ 2 such that p = m n .
But then 2 p − 1 = 2 m n − 1 which is divisible by 2 m − 1 and 2 n − 1 .
This contradicts the assumption that 2 p − 1 is a prime number.
So p must be a prime number.
Let M = 2 p − 1 .
u 2 1 ( M + 1 ) ≡ − 1 ( m o d M ) :
Since u = a + b and b = a 2 − 1 , u = 2 ( a + 1 ) ( a + 1 + b ) 2
so u 2 1 ( M + 1 ) = ( 2 ( a + 1 ) ( a + 1 + b ) 2 ) 2 1 ( M + 1 ) ≡ − 2 ( a + 1 ) 2 ( a + 1 ) ( m o d M ) = − 1 ( m o d M ) :
the numerator ( ( a + 1 + b ) 2 ) 2 1 ( M + 1 ) = ( a + 1 + b ) ( a + 1 + b ) M
using the binomial theorem in a finite field and prime exponent M , ( a + 1 + b ) M ≡ ( a + 1 ) M + b M ( m o d M )
and using Fermat’s Little Theorem , ( a + 1 ) M ≡ a + 1 ( m o d M )
since b = a 2 − 1 , b M = ( a − 1 ) 2 1 ( M − 1 ) ( a + 1 ) 2 1 ( M − 1 ) b
and since by the given criteria ( a − 1 ) 2 1 ( M − 1 ) ≡ 1 ( m o d M ) and ( a + 1 ) 2 1 ( M − 1 ) ≡ − 1 ( m o d M ) , b M ≡ ( 1 ) ( − 1 ) b = − b ( m o d M )
therefore, ( a + 1 + b ) M ≡ ( a + 1 − b ) ( m o d M )
so ( a + 1 + b ) ( a + 1 + b ) M ≡ ( a + 1 + b ) ( a + 1 − b ) ( m o d M ) and since b = a 2 − 1 , this is equivalent to 2 ( a + 1 ) ( m o d M )
so the numerator ( ( a + 1 + b ) 2 ) 2 1 ( M + 1 ) ≡ 2 ( a + 1 ) ( m o d M )
the denominator ( 2 ( a + 1 ) ) 2 1 ( M + 1 ) = 2 2 1 ( M − 1 ) ( a + 1 ) 2 1 ( M − 1 ) 2 ( a + 1 )
since M = 2 p − 1 , 2 2 1 ( M − 1 ) = 2 2 1 ( ( 2 p − 1 ) − 1 ) = 2 2 p − 1 − 1 .
by Fermat's Little Theorem , 2 p − 1 − 1 = k p for some integer k , so 2 2 p − 1 − 1 = 2 k p = ( 2 p ) k .
since 2 p ≡ 1 ( m o d 2 p − 1 ) , ( 2 p ) k ≡ 1 k = 1 ( m o d 2 p − 1 = M ) ,
and so 2 2 1 ( M − 1 ) ≡ 1 ( m o d M ) .
by the given criteria, ( a + 1 ) 2 1 ( M − 1 ) ≡ − 1 ( m o d M )
so the denominator 2 2 1 ( M − 1 ) ( a + 1 ) 2 1 ( M − 1 ) 2 ( a + 1 ) ≡ ( 1 ) ( − 1 ) 2 ( a + 1 ) = − 2 ( a + 1 ) ( m o d M ) .
Since u 2 1 ( M + 1 ) ≡ − 1 ( m o d M ) :
u 4 1 ( M + 1 ) u 4 1 ( M + 1 ) ≡ − 1 ( m o d M )
u 4 1 ( M + 1 ) u 4 1 ( M + 1 ) u 4 1 ( M + 1 ) ≡ − u 4 1 ( M + 1 ) ( m o d M )
u 4 1 ( M + 1 ) ( u u ) 4 1 ( M + 1 ) ≡ − u 4 1 ( M + 1 ) ( m o d M )
u 4 1 ( M + 1 ) ( 1 ) 4 1 ( M + 1 ) ≡ − u 4 1 ( M + 1 ) ( m o d M )
u 4 1 ( M + 1 ) ≡ − u 4 1 ( M + 1 ) ( m o d M )
u 4 1 ( M + 1 ) + u 4 1 ( M + 1 ) ≡ 0 ( m o d M )
u 4 1 ( ( 2 p − 1 ) + 1 ) + u 4 1 ( ( 2 p − 1 ) + 1 ) ≡ 0 ( m o d M )
u 4 1 ( 2 p ) + u 4 1 ( 2 p ) ≡ 0 ( m o d M )
u 2 p − 2 + u 2 p − 2 ≡ 0 ( m o d M )
s p − 2 ≡ 0 ( m o d M )
Therefore, if 2 p − 1 is a prime number, then s p − 2 is divisible by 2 p − 1 .