Where is the error in this incorrect proof of Wolstenholme’s theorem

elementary-number-theorymodular arithmeticprime numbers

I'm trying to prove for a prime $p>3$ $$\sum_{k=1}^{p-1}k^{-1}\equiv 0\pmod {p^2}$$ Now since the inverse of any number in $\{1,\ldots,p-1\}$ is in $\{1,\ldots,p-1\}$ we get $$\sum_{k=1}^{p-1}k^{-1}\equiv \sum_{k=1}^{p-1}k=\frac{p(p-1)}{2}\equiv 0\pmod p$$
In fact it is never $0\pmod{p^2}$. Can you help me find the mistake in my reasoning?

Best Answer

The mistake is that the inverse mod $p$ is in $\{1,\ldots,p-1\}$, but that's not the same as the inverse mod $p^2$.

Related Question