# Proof that $\sum\limits_i \frac{(p-1)!}i$ is divisible by $p$

Problem: Let $p$ be a prime. Consider $\sum\limits_{i = 1}^{p-1} \frac1i = \frac K{(p-1)!}$. Rearranging, we have $K = \sum\limits_{i = 1}^{p-1} \frac{(p-1)!}i$. Prove that $p \mid K$.

Hint: consider the factorization $x^{p-1} - 1 \equiv (x-1) ...(x - (p-1)) \pmod{p}$.

Attempt: I am finding applying the hint difficult. Sure, the RHS of the congruence relation contains $(p-1)!$, but I can't see how the factorization would help me prove the expression for $K$. Any help is appreciated.

• Do you know that the integers modulo $p$ form a field? Have you worked with fields before? – Bart Michels Apr 4 '18 at 20:37
• No I haven't worked with fields before. – Longti Apr 4 '18 at 20:38
• What is the coefficient of $x$ on both sides? – Daniel Fischer Apr 4 '18 at 20:38
• @DanielFischer Thanks for the hint. I can see that the coefficient is exactly $-K$. I also know $(p-1)! \equiv -1 \pmod{p}$. Comparing coefficients we get $p|K$. Is this correct? – Longti Apr 4 '18 at 21:01
• If $p$ is an odd prime. For $p = 2$ we have $K = 1$ and the assertion doesn't hold. – Daniel Fischer Apr 4 '18 at 21:03

Suppose $p$ is an odd prime. By the hint, we have that $$p^{p-1} - 1 \equiv (p-1)! \pmod p.$$ On the other hand $$p^{p-1} -1 \equiv -1 \pmod p.$$ Putting these two facts together gives $$(p-1)! \equiv -1 \pmod p.$$ Therefore, $$K \equiv \sum_i^{p-1}\frac{-1}{i} \pmod p.$$ Can you finish from here?
• Like Daniel Fisher said, when $p = 2$, $K=1$, so the statement doesn't hold for $p = 2$. As for your last line, I can see that $K \equiv -(K/(p-1)!) \pmod{p}$, the congruence relation can only hold if $K \equiv 0 \pmod{p}$. Is my reasoning correct? – Longti Apr 4 '18 at 21:11
I have a much simpler solution. But I will start by stating that this is problem number 60 from this book (more complicated since it asks for $p^2 \mid K, p>3$) and the solution below is not from the book. So, for $p>2$ we have $p-1$ even and $$\sum\limits_{i=1}^{p-1}\frac{1}{i}=\sum\limits_{i=1}^{\frac{p-1}{2}}\frac{1}{i}+\sum\limits_{i=\frac{p+1}{2}}^{p-1}\frac{1}{i}= \sum\limits_{i=1}^{\frac{p-1}{2}}\frac{1}{i}+\sum\limits_{i=1}^{\frac{p-1}{2}}\frac{1}{p-i}=\\ \sum\limits_{i=1}^{\frac{p-1}{2}}\left(\frac{1}{i}+\frac{1}{p-i}\right)= \sum\limits_{i=1}^{\frac{p-1}{2}}\frac{p}{i(p-i)}=p\sum\limits_{i=1}^{\frac{p-1}{2}}\frac{1}{i(p-i)}=p\frac{A}{(p-1)!}$$ where $K=pA$ and $A \in \mathbb{N}$.