On this page we prove the following theorem
(which we use on our page about Mersenne
primes and the historical note "the
Largest Known Prime by Year"). Fermat discovered and use the first
part of this theorem (p = 1 modulo q) and Euler discovered
Let p and q be odd primes. If p divides Mq,
then p = 1 (mod q) and p = +/-1 (mod 8).