# How to prove that $1^n+2^n+...+(p-1)^n \equiv 0\pmod p$? [duplicate]

I have a homework for the university and I am 'on this' for the entire week, so I really need help.

The question:

let $$p>2$$ be a prime number and $$n\in \Bbb N$$, $$\ p-1\nmid n$$.

Prove that $$1^n+2^n+...+(p-1)^n \equiv 0\pmod p$$.

I thought:

1. it is pretty clear that $$p-1$$ is composite so I can write $$p-1=q_1^{t_1}q_2^{t_2}...q_k^{t_k}=\prod_{i=0}^{k} q_i^{t_i}$$ and I know that $$2 \le q_i\le p-1 \ , \ \ 0 \le i \le k \$$ and that $$\ 2\mid p-1$$ so $$\ p-1=2k$$.
2. The sum is $$\sum_{i=0}^{p-1} i^n=1^n+2^n+...+(p-1)^n \equiv 0\pmod p$$ but I don't know what can I understand from that.

I really need help.

Thank you

Consider a primitive root $$g \bmod{p}$$. We have: $$1^n+2^n+\ldots+(p-1)^n \equiv 1+g^n+g^{2n}+\ldots+g^{(p-2)n}=\frac{g^{(p-1)n}-1}{g^n-1} \pmod{p}$$
As $$p-1 \nmid n$$, we have $$p \nmid (g^n-1)$$. As $$p-1 \mid (p-1)n$$, we have $$p \mid (g^{(p-1)n}-1)$$. That shows that: $$p \mid \frac{g^{(p-1)n}-1}{g^n-1} \implies p \mid (1^n+2^n+\ldots+(p-1)^n)$$
• The first congruence is true, because the sets $\{1,2,3,\ldots,p-1\}$ and $\{1,g,g^2,\ldots,g^{p-2}\}$ are the same modulo $p$, as $g$ is a primitive root. Jun 24, 2020 at 11:59