# Do there exist infinitely many primes $p$ such that $a^{p-1}\equiv 1$ $\text{mod } p^2$ for fixed a?

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.

-
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$](go.helms-net.de/math/expdioph/fermatquotients.pdf). –  draks ... Jun 21 '12 at 7:05

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:

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