If
Mp=2p-1 is prime ⇒
⇒ 2p-2⋮6 or 2p⋮6 ⇒
⇒ 2p-1-1⋮3 or 2p-1⋮3 ⇒
⇒ 2n-1⋮3 or 2n⋮3, n=p-1
In order to pick huge values for p to test if Mp is a prime number, I believe this is a good preliminary test before going with the computationally expensive Lucas-Lehmer test.
But what is the fastest, most efficient way to test if two numbers, 2n-1 and 2n, are divisible by 3.
Other info that we can use from this is that n always ends in 0, 2, 6 or 8 (because p=n+1 is a prime). Maybe it helps in some way.
Thank you!
$2^n$ is never divisible by 3, by the fundamental theorem of arithmetic.
$2^n - 1$ is divisible by 3 iff $n$ is even, by Fermat's Little theorem / Euler's theorem.