I'm considering the following sums for natural numbers n,m $ s_m(n)= \sum_{k=1}^{n-1} k^m =1^m+2^m+3^m+\cdots+(n-1)^m $ modulo n .
Looking at odd n first, I found by analysis of the pattern of $s_m(n) \pmod n \quad $ the following expression $ S_m(n) = n \cdot\sum_{ p \vert n } \underset{p-1}{\overset m\sim} \cdot \left(1-{1 \over p}\right) $ where $p \in \mathbb P$ and the fractional-like expression using the $ \sim $-symbol means $ \underset{a}{\overset b\sim} = \Tiny \begin{cases} 1& \text {if } a \mid b \\ 0 & \text{if } a \nmid b\end{cases}$
It seems, that the two expressions are equivalent modulo n $ s_m(n) \equiv S_m(n) \pmod n$ but after a couple of tries I still don't see how I could prove this. Can someone help?
Remark/context: it may be too difficult because I found it while I'm fiddling with the Agoh-Giuga-conjecture, which is still open. On the other hand it is a detail only, has a simple structure involving only the Euler's phi-function and might be easily provable, worth the effort on its own right anyway
Remark 2: I approached it also using the Bernoulli-polynomials for the sums, but didn't yet find a usable way for the proof of the identity
Remark 3: it seems, it works for even numbers n too, except that a correction is needed if at the same moment n is divisible by 4 and m=1 ; but this shouldn't matter too much for the general question here