TITLE: Do there exist infinitely many primes $p$ such that $a^{p-1}\equiv 1$ $\text{mod } p^2$ for fixed a?
QUESTION [9 upvotes]: 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 \bmod p^2 \tag{*}\;\;\;?$$

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.

REPLY [8 votes]: 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 known examples:
\begin{eqnarray}
a&  p&  \text{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 had a paper on that: 
Fermat-/Euler-quotients $(a^{p-1}-1)/p^k$ with arbirtrary $k$.