# Prove $\sum_{n = 1}^{p - 1} n^{p - 1} \equiv (p - 1)! + p \pmod {p^2}$ for $p$ being an odd prime

I need to prove the following:

$$\sum_{n = 1}^{p - 1} n^{p - 1} \equiv (p - 1)! + p \pmod {p^2}$$

...with $$p$$ being an odd prime number. The statement is obviously true for$$\pmod p$$ because left-hand side is congruent to $$-1 \pmod p$$ by Fermat's little theorem, and the right-hand side also turns out to be congruent to $$-1 \pmod p$$ by Wilson's theorem. Now, I am not sure how to make a jump from$$\pmod p$$ to$$\pmod {p^2}$$, if that is even possible. Maybe the sum on the left could somehow be modified using the existence of the primitive root$$\pmod {p^2}$$.

EDIT: Elementary solution can be found here: https://mathoverflow.net/a/319824/134054

• @MohammadZuhairKhan Yes, thanks. I have corrected the formatting – Oldboy Dec 29 '18 at 11:56
• This is probably true for odd $p$ – Aqua Dec 29 '18 at 12:10
• My bad, I have corrected the statement. I apologize for that. – Oldboy Dec 29 '18 at 12:13
• @Oldboy Isn't Fermat's little theorem, only $a^p \equiv a \pmod p$ and not for the series? – toric_actions Dec 29 '18 at 12:46
• Elementary proof can be found here: mathoverflow.net/a/319824/134054 – Oldboy Dec 31 '18 at 17:29

$$\sum^{p-1}_{n=1}n^{p-1}=\frac{1}{p}\sum^{p}_{n=1}C^{p-n}_{p}B_{p-n}p^n=\sum^{p}_{n=1}C^{p-n}_{p}B_{p-n}p^{n-1}$$ where $$B_k$$ is the $$k$$-th Bernoulli number.