<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] For $X>0$, and sequence indexed by $n > 0$: 
$X^n$ repeats each $2 - 1$ in $\pmod 2$ since $2$ is prime.
$X^n$ repeats each $5 - 1$ in $\pmod 5$ since $5$ is prime.
So the sequence $X^n$ repeats each ${\rm gcd}(2 - 1, 5 - 1)$ in $\pmod {10}$, so you only have to check the value of 
$$\sum_{X = 1}^9 X^n \pmod {10}$$
for the values $n \in \{1, 2, 3, 4\}$ and the sequence will repeat, and the case $n = 0$ should be considerred separately.
</s>