Prove that $\sum^{n-1}_{i=1}i^{(n-1)} \equiv -1$ (mod $n$) for all prime $n\in\mathbb{N}$.
I'm having a difficult time proving this problem. I was able to verify that it works for prime $n$ up to 5000 using Python.
I'm assuming induction would be useful in this case? Would love some help with this problem!
It's an obvious case of Fermat's little theorem, or, as demons like me prefer to call it, Fermat's theorem. Whoever got to your question first would immediately know that's the answer.
If $p$ is prime and $a$ is coprime to $p$, then $a^{p - 1} \equiv 1 \pmod p$, Fermat's theorem tells us.
Then, with $$\sum_{i = 1}^{n - 1} i^{n - 1},$$ if $n$ is prime, we know that all $0 < i < n$ are coprime to $n$, and therefore each $i^{n - 1} \equiv 1 \pmod n$. And since there are $n - 1$ instances of $i$ that we loop through, we find that $$\sum_{i = 1}^{n - 1} i^{n - 1} \equiv n - 1 \pmod n,$$ and $n - 1$ is just another way to write $-1$ in this context.
Edit: Someone attempted to correct one of my mistakes and wondered whether it was intentional or unintentional. Well, let me reassure you, all my mistakes are intentional. For one silly reason, that guy's attempt to correct my mistake was shot down, so I have corrected the mistake myself.