Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I noticed that Hardy and Wright in their "An Introduction to Theory of Numbers"(sixth edition) have asked the following:

Is it ever true that $$2^{p-1}\equiv 1 \text{mod} p^2\dots (*) ?$$

They have pointed out that for $p=1093$ there is a solution to $(*)$ .But they have stated that such $p$ are sparse .

Question: Do there exist infinitely many primes $p$ such that $a^{p-1}\equiv 1$ $\text{mod } p^2$? for some fixed $a\in Z^\mathbb{+}$ for $a>2$? Sorry if my question is absolutely trivial.

Edit:I edited the question.

share|cite|improve this question
This is related to Wieferich primes: Despite a number of extensive searches, the only known Wieferich primes to date are 1093 and 3511. (sequence A001220 in OEIS). – draks ... Jun 21 '12 at 7:02
It turns out my question is hilarious.Sorry about that.I am voting to close.Thanks. – user31029 Jun 21 '12 at 7:03
Why? You asked for $a>2$. See here for Generalized Wieferich primes... Gottfried Helms put a paper on the wiki page: [Fermat-/Euler-quotients $(a^{p-1}-1)/p^k$ with arbirtrary $k$]( – draks ... Jun 21 '12 at 7:05
up vote 6 down vote accepted

Your question is related to Wieferich primes, which represent the case if $a=2$:

Despite a number of extensive searches, the only known Wieferich primes to date are 1093 and 3511. (sequence A001220 in OEIS).

You asked for the more general case $a>2$. See here for Generalized Wieferich primes. Here's the table of know examples:

\begin{eqnarray} a& p& OEIS sequence\\ 2 & 1093, 3511 & A001220\\ 3& 11, 1006003& A014127\\ 5& 2, 20771, 40487, 53471161, &&\\ &1645333507, 6692367337, 188748146801 & A123692\\ 7& 5, 491531 & A123693\\ 11& 71 & \\ 13& 2, 863, 1747591 & A128667\\ 17& 2, 3, 46021, 48947, 478225523351 & A128668\\ 19& 3, 7, 13, 43, 137, 63061489 &A090968\\ 23& 13, 2481757, 13703077, 15546404183, 2549536629329 & A128669\\ \end{eqnarray}

Gottfried Helms (I think he's a member here...) put a paper on the wiki page:

Fermat-/Euler-quotients $(a^{p-1}-1)/p^k$ with arbirtrary $k$.

share|cite|improve this answer
yes, I'm that one. Didn't look at this problem for a couple of monthes though... – Gottfried Helms Jun 21 '12 at 11:35

The question is not clear. If you are asking whether there are infinitely many pairs $(a,p)$ with $p$ prime such that $a^{p-1}\equiv1\pmod {p^2}$ then the answer is yes. For example, for $p=3$ this just asks for $a^2\equiv1\pmod9$, which is satisfied by $a=8,10,17,19,\dots$. For $p=5$, you want $a^4\equiv1\pmod{25}$, and any $a$ congruent to 1, 7, 18, or 24 modulo 25 will do. In general, any $a\equiv\pm1\pmod{p^2}$ will do.

If the question is whether, for fixed $a$, there are infinitely many $p$, see the comments by draks.

share|cite|improve this answer
Yes, I mean for fixed a.I have edited the question. – user31029 Jun 21 '12 at 7:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.