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??
 A: Modulo $10$ easy inductions show that
$$\begin{align*}
&1^n+9^n\equiv\begin{cases}
0,&\text{if }n\text{ is odd}\\
2,&\text{if }n\text{ is even}\;,
\end{cases}\\
&2^n+8^n\equiv\begin{cases}
0,&\text{if }n\text{ is odd}\\
8,&\text{if }n\equiv 2\pmod4\\
2,&\text{if }n\equiv 4\pmod4\;,
\end{cases}\\
&3^n+7^n\equiv\begin{cases}
0,&\text{if }n\text{ is odd}\\
8,&\text{if }n\equiv 2\pmod4\\
2,&\text{if }n\equiv 0\pmod4\;,
\end{cases}\\
&4^n+6^n\equiv\begin{cases}
0,&\text{if }n\text{ is odd}\\
2,&\text{if }n\text{ is even}\;,\text{ and}
\end{cases}\\
&5^n\equiv 5\;.
\end{align*}$$
Thus, 
$$\sum_{k=1}^9k^n\equiv\begin{cases}
5,&\text{if }n\not\equiv0\pmod4\\
3,&\text{if }n\equiv 0\pmod4\;.
\end{cases}$$
And as a quick check of the second case above,
$$\sum_{k=1}^9k^4=1+16+81+256+625+1296+2401+4096+6561=15,333\;.$$
Note that the stated result is true only when $n$ is not a multiple of $4$.
A: 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?
A: Our sum is odd, so all we need to do is to compute it modulo $5$.
Note that the congruence class of $k^n$ modulo $5$ is the same as the congruence class of $k^{n+4}$ modulo $5$. This is obvious if $k$ is divisible by $5$. And if $k$ is not divisible by $5$ then $k^4\equiv 1\pmod{5}$.
So to find the last digit for any $n$, it is enough to know the last digit for $n=1,2,3,4$. Now you need to compute the last digit for $n=1,2,3,4$, and you will know the situation for all $n$.
A: Given that the order of any of the components here will divide $4$, since that is the Carmichael function value for $10$, it is only necessary to check the values for $n=\{1,2,3, 4\}$. The results follow a pattern across the range of values (all $\bmod 10$):
$$\begin{array}{c|c}
n & 1^n & 2^n & 3^n & 4^n & 5^n & 6^n & 7^n & 8^n & 9^n & \sum  \\ \hline
1 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 5 \\ \hline
2 & 1 & 4 & 9 & 6 & 5 & 6 & 9 & 4 & 1 & 5 \\ \hline
3 & 1 & 8 & 7 & 4 & 5 & 6 & 3 & 2 & 9 & 5 \\ \hline
4 & 1 & 6 & 1 & 6 & 5 & 6 & 1 & 6 & 1 & 3 
\end{array}$$ 
and you can check that the following line for $n=5$ repeats the values for $n=1$ if required.
Thus the answer is that the last digit is $3$ when $n\equiv 0 \bmod 4$ and is $5$ otherwise.
A: If $n$ is odd, then as in the answer by @Semiclassical, $1^n+2^n+3^n+4^n+5^n+6^n+7^n+8^n+9^n\equiv5\pmod{10}.$
If $n$ is even, say $n=2m,$ then first observe $4^m\equiv 5+(-1)^m\pmod{10}$ and $9^m\equiv(-1)^m\pmod{10}.$
So we have
 $\begin{align}1^n+2^n+3^n+4^n+5^n+6^n+7^n+8^n+9^n&\equiv2(1+2^n+3^n+4^n)+5^n\\&\equiv2(1+(5+(-1)^m)+((-1)^m)+(5+(-1)^{2m}))+5\\
&\equiv4(1+(-1)^m)+5\pmod{10}\end{align}$  
Hope this helps.
A: 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.
