TITLE: Proof of Wolstenholme's theorem
QUESTION [10 upvotes]: According to the theorem, if
$$1+\frac{1}{2}+\frac{1}{3}+\frac{1}{4}+\frac{1}{5}+\cdots+\frac{1}{p-1} =\frac{r}{q}$$
then we have to prove that $r\equiv0 \pmod{p^2}$.
(Given $p>3$, otherwise $1+\dfrac{1}{2}=\dfrac{3}{2}$, $3 \not\equiv  0 \pmod 9$.)
I guess there's a $(\bmod p)$ solution for this, but I don't really get how to start it.

REPLY [3 votes]: I second Joel's comments. The proof given by Christian Aebi and Grant Cairns, in a sense, is misleading & harmful. Directly jumping into $\mathbb{Z}/p\mathbb{Z}$ without carefully observing suitability and justification is misleading and wrong. For example, when computing in $\mathbb{Z}/p\mathbb{Z}$, let $p=5$, then $\frac{1}{2} + \frac{1}{3}\equiv 3 + 2 \equiv0,$ but the numerator $mod\ 25$ is 5.
The original problem asks to prove the numerator $mod\ p^2$ is zero. One needs to be very careful when using $\mathbb{Z}/p\mathbb{Z}.$ For example, $\frac{3}{7} + \frac{1}{13}$'s numerator $mod\ 17$ is 12. But if calculating in $\mathbb{Z}/p\mathbb{Z}$ for $p=17$, one gets $\frac{1}{7}\equiv5, \frac{1}{13}\equiv4$ and $\frac{3}{7} + \frac{1}{13}\equiv2$. One can use $\mathbb{Z}/p\mathbb{Z}$ when handling $\sum_{k=1}^{(p-1)/2}\frac{1}{r(p-r)}$ is due to the guarantee of Wilson's theorem in the background, and the fact that we only care about if the modulus result is zero.