# Proof of Wolstenholme's theorem

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.

#### Solutions Collecting From Web of "Proof of Wolstenholme's theorem"

The group theoretic proof on Wikipedia is good.

Alternatively, another nice way is, working in $\mathbb{Z}/p\mathbb{Z}$,

$\displaystyle 2\sum_{n=1}^{p-1} \frac{1}{n} = 2 \sum_{n=1}^{(p-1)/2} \frac{1}{n} + \frac{1}{p-n} = 2p \sum_{n=1}^{(p-1)/2} \frac{1}{n(p – n)} \equiv -2p \sum_{n=1}^{(p-1)/2} n^2 \equiv -\frac{p(p-1)p(2p – 1)}{6}$

A more hands-on approach can be found in these notes by Timothy Choi.

Finally, an excellent survey and additional results here by Romeo Mestrovic.

$(1 + \frac 1 {p-1}) + (\frac 1 2 + \frac 1 {p-2}) + \ldots + (\frac 1 {(p-1)/2} + \frac 1 {(p+1)/2}) = \frac p {p-1} + \frac p {2(p-2)} + \ldots + \frac p {((p-1)(p+1)/4)} \\ = p \sum_{k=1}^{(p-1)/2} \frac 1 {k(p-k)} = \frac p 2 \sum_{k=1}^{p-1} \frac 1 {k(p-k)}$.

Now, working on this second sum in the field $\Bbb Z / p \Bbb Z$, and assuming $p>3$ you get :

$\sum_{k=1}^{p-1} \frac 1 {k(p-k)} = – \sum_{k=1}^{p-1} \frac 1 {k^2} = – \sum_{k=1}^{p-1} k^2 = -(p-1)p(2p-1)/6 = 0$.

If you don’t know the sum of the first consecutive squares formula, you can still get it with a bit more work :

Pick a number $a \neq 1$ such that $a$ is a square modulo $p$ (again assuming $p>3$).
Then, $\sum k^2 (1-a) = \sum k^2 – \sum (ak^2) = \sum k^2 – \sum k^2 = 0$. Since $1-a \neq 0$, $\sum k^2 = 0$.

(when $p = 3$, $1+ \frac 1 2 = \frac 3 2$ which is not a multiple of $3^2$)

Note that $\displaystyle \sum_{1 \le i \le p-1}\dfrac{1}{i}=\displaystyle \sum_{1 \le i \le \frac{p-1}{2}}\left ( \dfrac{1}{i}+\dfrac{1}{p-i} \right )=p \displaystyle \sum_{1 \le i \le \frac{p-1}{2}}\dfrac{1}{i(p-i)}=p \cdot \dfrac{a}{b}$.
Thus, enough to show that $a \equiv 0 \mod p$ or, equivalently, that integer

$$S=\displaystyle \sum_{1 \le i \le \frac{p-1}{2}}\dfrac{(p-1)!}{i(p-i)}$$

is a multiple of $p$. Let $r_i \in \mathbb{Z}_p$ st $ir_i \equiv 1 \mod p$. Note que $r_{p-i} \equiv -r_i \mod p$. So,

$$S \equiv \displaystyle \sum_{1 \le i \le \frac{p-1}{2}}\dfrac{(p-1)!}{i(p-i)}\cdot ir_i \cdot (p-i)r_{p-i} \mod p$$
$$S \equiv \displaystyle \sum_{1 \le i \le \frac{p-1}{2}}r_i^2 \mod p$$ by Wilson’s Theorem. Therefore,

$$S \equiv \displaystyle \sum_{1 \le i \le \frac{p-1}{2}}i^2 = \dfrac{p(p^2-1)}{24} \mod p$$

So, $S$ is a multiple of $p$.