[Up to Mathematics projects]

A note on the two known Wieferich Primes

By John Blythe Dobson (j.dobson@uwinnipeg.ca)

Although the author is employed by the University of Winnipeg, he has no affiliation with the Mathematics Department or with any other academic department.


In a search which began even before its objects had received their modern name, and which has now lasted the better part of two centuries [3], only two primes have ever been found which possess the Wieferich property (OEIS A001220), that p2 divides 2p − 2, or in other words, that p divides the Fermat quotient q2 = (2p − 1 − 1)/p. The search-limit for Wieferich primes has been extended to 6.7·1015 in [6], with no further examples being found. It is well known [5] that Mersenne primes 2q − 1 and Fermat primes 22n + 1 cannot have this property, because for such numbers p the associated Fermat quotient can be explicitly evaluated in terms of q or n, respectively, and it does not vanish mod p. This idea has been considerably extended in the work of Wells Johnson, especially in a 1978 paper [2] which lies beyond the scope of this note.

Johnson announces an observation on digital cyclicity

Johnson, in a 1977 paper [1] citing a personal communication from Lawrence Washington, pointed out the repetetiveness of the binary representations of the numbers which are one less than the two known Wieferich primes:

1093 − 1 = 1092 = 100010001002
3511 − 1 = 3510 = 1101101101102,

the cyclicity being imperfect in the case of 1092. Motivated by this observation, a search for “the binary periodic numbers of bit pseudo-length j ≤ 3500 obtained by replication of a bit string of bit pseudo-length k ≤ 24 and increased by one” found no further instance of a Wieferich prime” [7].

A restatement of Johnson’s announcement

In an attempt to derive a more uniform representation for these numbers, the present writer noticed that the cyclicity becomes perfect when the numeric bases are changed to higher powers of 2, as follows:

1092 = 44416
3510 = 66668.

These forms reveal that the numbers can be represented as very small multiples of so-called “reduced Fermatians” (as they were dubbed by James Joseph Sylvester) or generalized repunits (as they are now usually called):

1092 = 4 · (163 − 1)/(16 − 1) (base 10)
3510 = 6 · (84 − 1)/(8 − 1) (base 10).

Note (added 6 December 2011)

It has just come to our attention that essentially the same representation of 3510 was given in 2001 by Nico Benschop [8].

This may be significant, because these “reduced Fermatians” or “generalized repunits” (although they do not appear there under either name) play a central role in Johnson’s 1977 paper, in which he showed that they, like the Mersenne and Fermat numbers, cannot have the Wieferich property. Furthermore, he showed that their counterparts with + instead of − signs likewise cannot have the Wieferich property. If we tentatively postulate that a representation of the form

{m · (2rs − 1)/(2r − 1)} + 1,        (A)

with m necessarily even, is somehow characteristic of the Wieferich numbers, then certain restrictions on the parameters follow easily from the fact that the result cannot itself correspond to a “reduced Fermatian” (or to the counterpart thereof with a + sign). For example, numbers of the form

{2 · (22s − 1)/(22 − 1)} + 1

can, as is strongly hinted at in p. 198 of Johnson’s paper, be represented as

(22s + 1 + 1)/(2 + 1)

and so are disqualified as possible Wieferich primes. Similar relationships disqualify the forms in (A) in the case m = 10 with r = 4, and in the case m = 42 with r = 6; or in general, when

m = 2 · (4r/2 − 1)/(4 − 1).

However, for most of the forms represented in (A) there is no obvious reason why they should not generate candidate Wieferich primes.

To state Johnson’s criteria more precisely, we give two definitions based on special cases of corollaries from his 1977 paper [1]:

Johnson’s non-Wieferich numbers of the first kind
(his Corollary 5 with a = 2, b = 1)

If p is an odd prime and p − 1 has the particular 2-adic expansion:

p − 1 = 11…100…0  …  11…100…02,

where the number of digits in each of the t blocks [of 1s followed by 0s] is the constant k, then

p = (2jv + 1)/(2j + 1),

where j = k/2, v = 2t + 1, and

q2 ≡ (2k − 1)/(t + 1)k !≡ 0 (mod p).

It may be noted that the case k = 2 gives the Wagstaff primes (OEIS A000979). The initial terms of the entire sequence of Johnson’s non-Wieferich numbers of the first kind are:

3, 11, 13, 43, 241, 683, 2731, 43691, 61681, 174763, 2796203, 15790321, 715827883, 4278255361, 2932031007403, 4363953127297.

Johnson’s non-Wieferich numbers of the second kind
(his Corollary 6 with a = 2)

If p is an odd prime whose 2-adic expansion is of the form

p = 10…010…0  …  10…012

where each string of 0s is of length k − 1 and there are s occurences of the digit 1, then

p = (2ks − 1)/(2k − 1)


q2 ≡ −(2k − 1)/sk !≡ 0 (mod p).

Johnson noted that all Mersenne primes (OEIS A000668) and Fermat primes (OEIS A019434) are of this form, and in addition gave the example 73 = 10010012, which has the form 1 + 2n + 4n (see OEIS A051154). Collectively, Johnson’s non-Wieferich numbers of the second kind correspond precisely to OEIS A245730, of which the first 15 terms are:

3, 5, 7, 17, 31, 73, 127, 257, 8191, 65537, 131071, 262657, 524287, 2147483647, 4432676798593.

In order for the forms represented in (A) to exhibit perfect digital cyclicity, it is obvious that m must be strictly less than 2r. With this limitation, these are the primes now treated in OEIS A226542, “Primes p such that p − 1 can be represented as a repdigit number in some base < p which is a power of two”:

11, 19, 37, 43, 67, 103, 131, 137, 199, 239, 293, 331, 397, 439, 463, 521, 547, 661, 683, 727, 859, 911, 991, 1033, 1093, 1171, 1291, 1301, 1543, 1549, 1951, 2053, 2081, 2341, 2731, 2861, 3079, 3121, 3251, 3511, 3613, 3823, …,

where we have highlighted the Wieferich primes. If from this list we eliminate Johnson’s non-Wieferich primes of both kinds, we are left with

19, 37, 67, 103, 131, 137, 199, 239, 293, 331, 397, 439, 463, 521, 547, 661, 727, 859, 911, 991, 1033, 1093, 1171, 1291, 1301, 1543, 1549, 1951, 2053, 2081, 2341, 2861, 3079, 3121, 3251, 3511, 3613, 3823, ….
If it could somehow be shown that Wieferich primes must belong to this set, the labor of testing candidates would be substantially reduced.

The connection to square divisors of Mersenne numbers

Recalling the old and intriguing question whether it is possible for a Mersenne number 2p − 1 (with p prime) to have a square divisor, it is known that p would have to equal the order or haupt-exponent of 2 modulo a Wieferich prime; that is, p would be equal to the least value of h for which 2h − 1 is divisible by a Wieferich prime W, where h is some divisor of W − 1 [45]. However, for each of the two known Wieferich primes, h does not happen to be prime, because the minimal exponents of 2 occur with 10932 | 2364 − 1 and 35112 | 21755 − 1. The failure of the known Wieferich primes W to divide a Mersenne number of prime exponent may thus be characterized as an insufficiency of values of k for which 2 is a k-ic power residue (mod W); for example 1093 fails at the most basic level by not having 2 as a quadratic power residue, causing the order of 2 to be even and therefore not prime. If the numbers which are one less than a Wieferich prime are indeed constrained by the representation shown in (A), they would be much rounder (i.e. possess more divisors) than normal, requiring the existence of many values of k, and consequently forcing p to be a relatively small divisor of W − 1. So although a proof of the necessity of (A) would still be far from a proof (if such exists) of the squarefreeness of Mersenne numbers of prime exponent, it would at least provide an heuristic explanation of the failure to-date of the very extensive Mersenne factorization projects to discover any square divisors. For further discussion of this subject see our note On square divisors of Mersenne numbers.

An unexpected property of the divisor-sums

In the spirit of the observation made thirty years ago by Lawrence Washington and communicated through Wells Johnson, we close with one of our own — which may or may not be of any importance — concerning the numbers which are one less than the two known Wieferich primes. These two numbers share the common divisor 2·3·13 = 78, and it is a somewhat curious fact in itself that this number is so large. Now if σ(n) represents the sum the divisors of n, then

σ(1092) = 3136 = 112/39 · 1092
σ(3510) = 10080 = 112/39 · 3510.

It is a surprising coincidence that the ratios between each of these numbers and their respective divisor-sums should be precisely the same. The literature contains divisor-sum formulae which bear a tenuous resemblance to Fermat-quotient formulae, but we have not seen anything which might explain this phenomenon.

Note (added 24 August 2014)

At the time we wrote the above, we were unaware that σ(n)/n is known as the abundancy index of n. Jeppe Stig Nielsen has prepared for the Online Encylopedia of Integer Sequences an entry in which he studies numbers which share the abundancy index 112/39.


1. 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.

2. Wells Johnson, “On the p-Divisibility of the Fermat Quotients,” Mathematics of Computation 32 (1978): 297-301.

3. J. Knauer and J. Richstein, “The continuing search for Wieferich primes,” Mathematics of Computation 74 (2005): 1559-1563.

4. 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.

5. 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.

6. F.G. Dorais and D.W. Klyve, Near Wieferich Primes up to 6.7 × 1015 [PDF]. Dated November 27, 2008. Available online at http://www-personal.umich.edu/~dorais/docs/wieferich.pdf.

7. Jan Dobeš & Miroslav Kureš, “Search for Wieferich primes through the use of periodic binary strings,” Serdica Journal of Computing 4 (2010): 293–300. We are grateful to Felix Frölich for supplying a copy of a preprint of this paper. The project has a Statistics page at http://www.elmath.org/index.php?id=statistics.

8. Nico Benschop, Mersenne primes — meet Wieferich primes [PDF]. Posting to The Math Forum @ Drexel, dated 21 May 2001. Available online at http://mathforum.org/kb/message.jspa?messageID=313601.

First published 2 August 2007
With revisions through to 26 November 2015