# Mersenne numbers $M_{p-1}$ divisible by $p^2$

A Mersenne number $$M_{p-1}=2^{p-1}-1$$ where $$p$$ is a prime is always divisible by $$p,$$ by Fermat's little theorem.

We were interested in whether $$M_{p-1}$$ is ever divisible by $$p^2$$ as well. There are examples: for the 183rd prime $$1093$$ it turns out that $$2^{1092}-1$$ is divisible by $$1093^2,$$ and similarly for the 491th prime $$3511.$$ These two primes are the only ones that we found having this property among the first 500 primes.

Then we continued to look at the first 1,000,000 primes. And found that there were none to be found other than the two already found below the 500 mark. We were somewhat taken aback.

Is this behavior somehow to be expected? It seems similar to the abc conjecture, if there is possibly only a finite number of solutions to this congruency.

• If you consider the "probability" that $p^2\mid M_{p-1}$ to be $1/p$, then the expected number of hits up to $N$ is $\sum_{p\le N}1/p$. This is $\sim\ln\ln N$ which grows very slowly.... Commented Oct 19, 2018 at 18:21
• Those primes are known as Wieferich primes. Commented Oct 19, 2018 at 20:05
• Thanks for very useful info! Now I am curious about the possibility of $p^3|M_{p-1}.$ It seems that the "expected number of hits" is around $\sum_p 1/p^2 \approx .45$ total over all primes $p.$ Possibly among all primes, there might be exactly one hit! Commented Oct 21, 2018 at 11:04

## 1 Answer

As mentioned in the comments, primes $$p$$ so that

$$p^2|2^{p-1}-1$$

are called Wieferich primes. Very, very little is known about them. For example, we don't know if there are infinitely many Wieferich primes. As of now, the two you found are the only ones we know. We also, surprisingly, don't know if there are infinitely many non-Wieferich primes. I believe these same statements are still true if $$2$$ is replaced by any base $$b>1$$.

Side note: There's a fantastic website called the Online Encyclopedia of Integer Sequences. It contains over $$300,000$$ integer sequences that you can search if you find something you think someone else might have found before. For example, if you search those first two terms, the first sequence that comes up is the one you're looking for. I find this site quite useful.

• Thanks a lot! I read somewhere that $b=2$ can be replaced by any prime $b \leq 89.$ So there has to be open questions galore. What is wrong with $b = 97$ anyway, is it somehow special? Commented Oct 21, 2018 at 11:11
• @TommyR.Jensen I'm not sure where you read that, but I don't think $b$ needs to be prime, and I certainly don't know of any magnitude restriction. We know of no Wieferich primes for $b=47$, for example, but I believe it is still thought that they exist. Per the linked Wikipedia page:"It is a conjecture that there are infinitely many solutions of $a^{p-1}\equiv 1\bmod p^2$ for every natural number $a$." Commented Oct 21, 2018 at 16:52
• Is there a reference to a conjecture that there are infinitely many solutions of $a^{p-1} \equiv 1$ (mod $p^2$) for every $a$ with $\gcd(a,p)=1?$ Commented Oct 22, 2018 at 17:00
• @TommyR.Jensen There may be some useful references at The Prime Glossary, but I don't know of any in particular. Commented Oct 22, 2018 at 17:28