<s>[INST] Find the rightmost digit of: $1^n+2^n+3^n+4^n+5^n+6^n+7^n+8^n+9^n$ Find the rightmost digit of: $1^n+2^n+3^n+4^n+5^n+6^n+7^n+8^n+9^n(n$ arbitrary positive integer)
First of all I checked a few cases for small $n$'s and in all cases the rightmost digit was $5$, so maybe this is the case for all values of $n$.
Then I thought maybe it's better to consider odd and even cases for $n$ but there's no unified rule here, because for example: $8^2\equiv{4}\pmod{10}$ and  $8^4\equiv{6}\pmod{10}$. Any ideas??
 [/INST] Hint: This is equivalent to asking what $$1^n+2^n+3^n+4^n+5^n+6^n+7^n+8^n+9^n$$ is modulo $10$. But $m=m-10$ mod $10$, so modulo 10 the above is the same as
$$1^n+2^n+3^n+4^n+5^n+(-4)^n+(-3)^n+(-2)^n+(-1)^n.$$
What does this equal if $n$ is odd versus even?
</s>