# Why is this number always divisible by $p^2$

For any prime $p > 3$ it seems that if you look at the number $1^{-1} + 2^{-1} + \cdots +(p-1)^{-1}$ it will be divisible by $p^2$. It's easy to see that it's divisible by $p$, because you're just summing all the residue classes of mod $p$ but experimentation reveals it's also divisible by $p^2$ and I don't know why.

Edit: The inverses are modulo $p^2$. I'm basically asking why the numerator of the $p-1$-th harmonic number is divisible by $p^2$ if $p > 3$

• It's Wolstenholme's theorem (hope I got the spelling right). – Daniel Fischer Jan 23 '14 at 13:14
• @DanielFischer Ahh. That seems like the sort of thing that needs to be mentioned in the question. Especially since picking different equivalence classes will not keep it divisible by $p^2$. – Tobias Kildetoft Jan 23 '14 at 13:16
• This might be a duplicate of math.stackexchange.com/questions/554261/… – Christoph Jan 23 '14 at 13:35
• I downvoted because of the imprecision of the question. – Olivier Bégassat Jan 23 '14 at 13:41
• @OlivierBégassat I respectfully disagree. It was one early misinformed comment that steered the discussion off course into "mod $p$" speculation. The question itself needed only minor repair before this damage. The phrase you quote occurs in the context of testing for divisibility by $p$: of course in that context it's natural to refer to the residue classes mod $p$. The assumption that we'd continue to work mod $p$ when discussing divisibility mod $p^2$ is understandable but very much unwarranted. – Erick Wong Jan 23 '14 at 14:47

If it is true that the inverses are modulo $p$, then I think your conjecture is wrong. You are adding $p-1$ numbers which are all $< p$ (since we are working modulo $p$), so you get something strictly smaller than $p^2$, so unless it's zero it cannot be divisible by $p^2$.