Wolstenholme's Theorem

Wolstenholme's Theorem is a result in Number Theory from English Mathematician Joseph Wolstenholme. It states that for primes $p>3$ that if the equation

$1+\frac{1}{2}+\frac{1}{3}+\ldots+\frac{1}{p-1}=\frac{m}{n}$

holds for $\gcd(m,n)=1$ then $p^2~|~m$. An alternative statement is that

$\sum_{i=1}^{p-1}\frac{1}{i}\equiv 0\pmod{p^2}$.

The proof of the theorem relies on some rearrangement of the terms in the sum.

$2\sum_{i=1}^{p-1}\frac{1}{i}=\sum_{i=1}^{p-1}\left(\frac{1}{i}+\frac{1}{p-i}\right)=\sum_{i=1}^{p-1}\frac{p}{i(p-i)}\equiv p\sum_{i=1}^{p-1}-\frac{1}{i^2}\equiv-p\sum_{i=1}^{p-1}i^2=-\frac{p^2(p-1)(2p-1)}{6}\equiv 0\pmod{p^2}$

and the proof is complete.