Modular number theory problem Let $k\in\mathbb{N}, 2<p\in\mathbb{P}, p^{\alpha}\mid\mid n,\alpha\ge1$. Then prove that $$1^k+2^k+\ldots+n^k\equiv\begin{cases}\hfill 0\pmod{p^{\alpha}},& p-1\nmid k\\-\frac{n}{p}\pmod{p^{\alpha}},& p-1\mid k\end{cases}$$
Firstly, I proved for $n=p$. If $p-1\mid k$, then it can easily proved by Fermat's little theorem. Let $p-1\nmid k$. Since $p$ is a prime, it has a primitive root $g$ and it satisfies $\{1,g,g^2,\ldots,g^{p-2}\}=\{1,2,3,\ldots,p-1\}$. So it's sufficient to prove that $1+g^k+g^{2k}+\ldots+g^{(p-2)k}\equiv 0\pmod p\iff p\mid\frac{g^{(p-1)k}-1}{g^k-1}\iff p\cdot (g^k-1)\mid g^{(p-1)k}-1$. Since $(p, g^k-1)\neq1\iff p-1\nmid k$ and $p\mid g^{(p-1)k}-1,g^k-1\mid g^{(p-1)k}-1$, it's true.
And I can't continue that for $n=p^{\alpha}$ (for $p-1\nmid k$, it's similar to $n=p$. But I can't prove for $p-1\mid k$), $n=p^{\alpha}\cdot n_1$, where $n_1>1, (n_1,p)=1$ and so on. Can anyone help me?
 A: It's not difficult to check that it's enough to show it for $n=p^{\alpha}$.
We'll show it by induction over $\alpha$.
If $\alpha=1$ then it works. Assume the result holds for $\alpha-1$.
Then, mod $p^{\alpha}$, $\sum_{m=0}^{p^{\alpha}-1}{m^k} = \sum_{m=0}^{p^{\alpha-1}-1}{\sum_{l=0}^{p-1}{(m+p^{\alpha-1}l)^k}} = \sum_{m=0}^{p^{\alpha-1}-1}{\sum_{l=0}^{p-1}{m^k+kp^{\alpha-1}l}}=p\sum_{k=0}^{p^{\alpha-1}-1}{m^k}+kp^{\alpha-1}\sum_{l=0}^{p-1}{l} = p\sum_{k=0}^{p^{\alpha-1}-1}{m^k} = -p \cdot p^{\alpha-1}/p = -p^{\alpha}/p$.
A: Viewing everything as elements of $\Bbb{Z}/p^a\Bbb{Z}$,

*

*If $p-1\nmid k$  then take $p\nmid s, s^k \ne 1\bmod p$ $$\sum_{m\bmod p^a} m^k =\sum_{m\bmod p^a} (sm)^k=s^k\sum_{m\bmod p^a} m^k$$ which means that $\sum_{m\bmod p^a} m^k=0$.


*If $p-1|k$ then take the largest $b$ such that $(p-1)p^b | k$, since $m\to m^k$ , restricted to the units, is surjective to the subgroup of elements of the form $1+p^{b+1}l$ we get that $$\sum_{m\bmod p^a} m^k=\sum_{m\bmod p^a,p\ \nmid\ m} m^k+\sum_{m\bmod p^{a-1}} (pm)^k\\=(p-1)\sum_{l\bmod p^{a-1}} (1+p^{b+1} l)+p^k \sum_{m\bmod p^{a-1}} m^k$$
$$ = -p^{a-1}+p^k \sum_{m\bmod p^{a-1}} m^k$$
$$ = -p^{a-1}-p^k p^{a-2}-p^{2k} p^{a-3}-\ldots- p^{(a-1)k} p^{a-a}$$
$$ = -p^{a-1}$$
