We show that for a prime $p$ the smallest $a$ with $a^{p-1}$ that is not congruent to 1 modulo ${p^2}$ does not exceed $(\log p)^{463/252 + o(1)}$ which improves the previous bound $O((\log p)^2)$ obtained by H. W. Lenstra in 1979. We also show that for almost all primes $p$ the bound can be improved to $(\log p)^{5/3 + o(1)}$. These results are based on a combination of various techniques including the distribution of smooth numbers, distribution of elements of multiplicative subgroups of residue rings, bound of Heilbronn exponential sums and a large sieve inequality with square moduli.
Links:
[1] https://www.mpim-bonn.mpg.de/de/taxonomy/term/39
[2] https://www.mpim-bonn.mpg.de/de/node/3444
[3] https://www.mpim-bonn.mpg.de/de/node/246