Q: What was the name of the theorem which states $\frac{1}{1}+\frac{1}{2}+...\frac{1}{p-1}\equiv 0 \pmod{p^2}$? If $p>3$ is a prime number
$$\frac{1}{1}+\frac{1}{2}+...\frac{1}{p-1}\equiv 0 \pmod{p^2}$$
What was the name of this theorem? Somebody gave me the answer this morning and i forgot. :(

A: You have the sum $$1+\frac 12+\frac 13+\dots+\frac 1{p-1}\tag 1$$
Now, look that, $$\frac 1k+\frac 1{p-k}=\frac p{p(p-k)}.$$
So, the above sum $(1)$ turns out $$\frac p{1(p-1)}+\frac p{2(p-2)}+\dots+\frac p{(p-1)/2+(p+1)/2}\\=p\left(\frac 1{1(p-1)}+\frac 1{2(p-2)}+\dots+\frac 1{(p-1)/2+(p+1)/2}\right)\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;(\clubsuit)$$
So, now you only need to check out $$\frac 1{1(p-1)}+\frac 1{2(p-2)}+\dots+\frac 1{(p-1)/2+(p+1)/2}\equiv 0\pmod p\tag 2$$
Now, note that $p-k\equiv -k\pmod p$, so, in left side of $(2)$, you put $\frac 1{p-k}\equiv \frac1{-k}\pmod p$.
So, what you get is $$\frac 1{-1^2}+\frac 1{-2^2}+\dots+\frac 1{-((p-1)/2)^2}$$ or equivalently,$$\frac 1{1^2}+\frac 1{2^2}+\dots+\frac 1{((p-1)/2)^2}$$
Now, again you have $k\equiv -(p-k)\pmod p$, so, in left side of $(2)$, you have $$\frac 1{(-1)^2}+\frac 1{(-2)^2}+\dots+\frac 1{((-(p-1))/2)^2}$$
So, now you have $$\frac 1{1(p-1)}+\frac 1{2(p-2)}+\dots+\frac 1{(p-1)/2+(p+1)/2}\\\equiv \frac 1{1^2}+\frac 1{2^2}+\dots+\frac 1{((p-1)/2)^2}\\\equiv \frac 12\left[\frac 1{1^2}+\frac 1{2^2}+\dots+\frac 1{((p-1)/2)^2}+\frac 1{(-1)^2}+\frac 1{(-2)^2}+\dots+\frac 1{((-(p-1))/2)^2}\right]\\\equiv \frac 12\left[\frac 1{1^2}+\frac 1{2^2}+\dots+\frac 1{(p-1)^2}\right]\pmod p.$$
Now, by small example, you can easily see that $$\frac 1{1^2}+\frac 1{2^2}+\dots+\frac 1{(p-1)^2}\equiv 1^2+2^2+\dots (p-1)^2\pmod p$$
You also know that $$1^2+2^2+\dots+(p-1)^2=\frac {(p-1)p(2p-1)}{6}\equiv 0\pmod p.$$
So, from this you have $$\frac 1{1(p-1)}+\frac 1{2(p-2)}+\dots+\frac 1{(p-1)/2+(p+1)/2}\\\equiv \frac 1{1^2}+\frac 1{2^2}+\dots+\frac 1{(p-1)^2}\equiv 1^2+2^2+\dots (p-1)^2\equiv 0\pmod p$$ as well as $$\frac 1{1(p-1)}+\frac 1{2(p-2)}+\dots+\frac 1{(p-1)/2+(p+1)/2}\equiv 0\pmod p$$
So, from $(\clubsuit)$, you find that $$1+\frac 12+\frac 13+\dots+\frac 1{p-1}\equiv 0\pmod {p^2}$$
