Theorems on Wieferich Primes
By John Blythe Dobson (email@example.com)
Fermat’s Little Theorem states that the Fermat quotient
2p − 1 − 1 ≡ 0 (mod p2).
This page will not attempt to cover computational results, nor the observed digital cyclicity of the two known Wieferich primes, which has already been covered in our page A note on the two known Wieferich Primes. Rather, it will survey known theoretical results on Wieferich primes which require only a knowledge of elementary Number Theory, with new results being added as they become available. No originality is claimed for this material, which it is hoped will be useful to students.
Theorem 1 (Gallardo, 2010)
A prime q = 2p + 1 with p prime and p ≡ 3 (mod 4) cannot be a Wieferich prime
We rewrite the proof of this interesting observation by Luis H. Gallardo  to avoid explicit references to group-theoretic principles. Gallardo offers two slightly different versions of the proof, and a third proof based on properties of Bernoulli numbers, which we do not reproduce.
A prime p such that 2p + 1 is also prime is known as a Sophie Germain prime. If p ≡ 3 (mod 4), then q = 2p + 1 ≡ 7 (mod 8), and by Euler’s criterion, a prime of the form ±1 (mod 8) has 2 as a quadratic residue; in other words,
2(q − 1)/2 − 1 ≡ 0 (mod q).
2p − 1 ≡ 0 (mod q),
so that, incidentally, q is a divisor of the Mersenne number Mp = 2p − 1. Because the left-hand side has no algebraic divisor, p is the least exponent x for which
An 1867 theoreom of Lebesgue  (see Appendix) states that if a is a primitive root of q, then so is its modular inverse a′ ≡ 1/a ≡ aφ(q)−1 ≡ aq−2, and that at least one of a and a′ is a primitive root of q2. In the present case, since −2 is a primitive root of q, it follows that −2 or its modular inverse −½ is a primitive root of q2, i.e. the order of at least one of them modulo q2 is φ(q2) =
Now assume that q possesses the Wieferich property, i.e. that 2q − 1 ≡ 1 (mod q2), implying that the order of 2 modulo q2 is q − 1. But then it would follow that
(−2)2p ≡ (−1)2p·22p ≡ 22p ≡ 1 (mod q2)
(−½)2p ≡ (−1)2p/22p ≡ 1 (mod q2),
so the orders of −2 and −½ would each be 2p <
Lebesgue’s Theorem on primitive roots (1867)
In  Lebesgue states without proof the following theorem: If a is a primitive root of q, then so is its modular inverse a′, and furthermore at least one of a and a′ is a primitive root of q2. The following proof is adapted from an elegant paper by Maxfield & Maxfield , where a far more general result is obtained.
If a > 1 belongs to the exponent e (mod p), then by definition 1 > e ≥
ae = 1 + kp.
ape = (1 + kp)p = 1 + pkp + …
(with further terms divisible by p3)
≡ 1 (mod p2),
So that if x is the exponent to which a belongs (mod p2), x must divide pe. But also ax ≡ 1 (mod p2) implies ax ≡ 1 (mod p), whence e divides x. Thus x equals e or pe. So if a is a primitive root of p, i.e. e =
If the latter, the proof is complete. Otherwise, ax = ae ≡ 1 (mod p2), and for some integer c,
(a′) = ae − 1 + cp,
(a′)e = (ae − 1 + cp)e ≡ (ae)e − 1 + eae − lcp + …
(with further terms divisible by p2)
≡ 1 + eae − lcp (mod p2).
In order that we should likewise have (a′)e ≡ 1 (mod p2), it would be necessary for p to divide c. In that case, we should have a·a′ ≡ ae + acp ≡ 1 (mod p2), which would imply a·a′ ≥
Note that Lebesgue stated that “at least one of” a, a′ is a primitive root of p2. Indeed they may both be; for example 2 and its inverse 3, which are primitive roots of 5, are also primitive roots of 25.
1. Luis H. Gallardo, “On special Wieferich’s primes,” preprint at http://arxiv.org/abs/1002.3840.
2. W. Johnson, “On the nonvanishing of Fermat quotients (mod p),” Journal für die Reine und Angewandte Mathematik 292 (1977): 196-200. Available online at http://www-gdz.sub.uni-goettingen.de/cgi-bin/digbib.cgi?PPN243919689_0292.
7. A. Rotkiewicz, “Sur les nombres de Mersenne dépourvus de diviseurs carrés et sur les nombres naturels n tels que n2 | 2n − 2,” Matematički Većnik / Matematicki Vesnik 2(17) (1965): 78–80. We first learned of this little-known paper through various writings of Paulo Ribenboim.
8. Le Roy J. Warren and Henry G. Bray, “On the Square Freeness of Fermat and Mersenne Numbers,” Pacific Journal of Mathematics 22 (1967): 563–4. Available online at http://projecteuclid.org/handle/euclid.pjm/1102992105.
First published 4 October 2014
With minor revisions through to 15 June 2015