# How can I prove that $\sum_{k=1}^{18}{\frac{18!}{k}}\equiv 0 \pmod {19}$ [duplicate]

I encountered following math problem I could use some help with. How can I prove that $$\sum_{k=1}^{18}{\frac{18!}{k}}\equiv 0 \pmod {19}$$

I have tried already: $$\sum_{k=1}^{18}{\frac{18!}{k}}= 18!\bullet \sum_{k=1}^{18}{\frac{1}{k}}$$

And using Wilson’s theorem with $$p=19$$ I get:

$$\sum_{k=1}^{18}{\frac{18!}{k}}\equiv\left(\sum_{k=1}^{18}{\frac{1}{k}}\right)\bullet(-1) \pmod {19}$$ But this is then: $$\neq 0 \pmod {19}$$

• The $18!$ is irrelevant (it just cancels out), and every element $\pmod {19}$ has a unique additive inverse (not equal to itself).
– lulu
Commented Jan 6, 2023 at 21:50
• Why is the sum over $1/k$ (considered as an inverse mod $19$) nonzero? Consider the shorter computation mod $3$ or $5$. Commented Jan 6, 2023 at 21:54
• Another proof can be that $p(x)=\prod_{k=1}^{18}(x-k)-x^{18}+1$ has degree $17$. By Fermat's little theorem, and since $19$ is prime, all the $18$ numbers $1,2,...,18$ are roots. Since $19$ is prime, then all its coefficients must be zero modulo $19$. One of its coefficients is your sum. The coefficient of the linear term. Incidentally, this is also one of the ways to prove one direction of Wilson's theorem. which is the statement that the constant coefficient is zero modulo $19$.
– plop
Commented Jan 6, 2023 at 22:03
• @lulu It isn't completely irrelevant if you mean that $18!/k$ is the integer $18!/k$ rather that the class $18!\cdot k^{-1}$ modulo $19$, but in this case it's all the same. Commented Jan 6, 2023 at 22:03
• Special case of Gauss / Wilson reflection in the linked dupe since $\,f(n) := n^{-1}\,$ is an odd function. $\ \$ Commented Jan 6, 2023 at 22:46

You're close; since 19 is prime, each $$k$$ has a unique multiplicative inverse. Thus, we have that $$\sum_{k=1}^{18} \frac{1}{k} = \sum_{k=1}^{18} k \pmod{19}.$$ This should finish off the proof.
• So do you mean that: $$\sum_{k=1}^{18}{\frac{18!}{k}}\equiv\left(\sum_{k=1}^{18}{\frac{1}{k}}\right)\bullet(-1) \pmod {19}\equiv - \sum_{k=1}^{18}{\frac{1}{k} \pmod{19}\equiv \sum_{k=1}^{18}{k}\pmod{19}\equiv 0\pmod\{19}$$ did I get that right?
Notice that for any $$k=1,\dots,9$$, $$\frac{1}{k}+\frac{1}{19-k}=\frac{19}{k(19-k)},$$ so $$\sum_{k=1}^{18}\frac{1}{k}=\sum_{k=1}^{9}\frac{19}{k(19-k)}.$$ And since $$19$$ is prime, it does not cancel with any factor in the denominator.