Find $x$ such that $$\sum_{k=1}^{2014} k^k \equiv x \pmod {10}$$
I knew the answer was $3$.
Find $x$ such that $$\sum_{k=1}^{2014} k^k \equiv x \pmod {10}$$
I knew the answer was $3$.
We are going to compute the sum mod $2$ and mod $5$. The Chinese Remainder Theorem then gives us the result mod $10$.
Mod $2$, obviously $$k^k \equiv \begin{cases}0 & \text{if }k\text{ even,}\\1 & \text{if }k\text{ odd,}\end{cases}$$ so $$\sum_{k = 0}^{2014} \equiv \frac{2014}{2} = 1007 \equiv 1 \mod 2.$$
By Fermat, $k^k$ mod $5$ only depends on the remainder of $k$ mod $\operatorname{lcm}(5, 4) = 20$. So $$\sum_{k = 1}^{2014}k^k \equiv \underbrace{100}_{\equiv 0} \cdot \sum_{k=1}^{20} k^k + \sum_{k=1}^{14} k^k \\ \equiv 1 + 4 + 2 + 1 + 0 + 1 + 3 + 1 + 4 + 0 + 1 + 1 + 3 + 1 \\\equiv 3 \mod 5.$$
Combining the results mod $2$ and mod $5$, $$\sum_{k=1}^{2014} k^k \equiv 3\mod 10.$$
This is asking for the last digit of that sum. So we may ignore everything but the last digit of each number. Now eliminate the few last terms for a minute and consider:
$$(1^1+\cdots +9^9)+(1^{11}+\cdots +9^{19})+\cdots+(1^{2001}+\cdots +9^{2009})\equiv \,?\pmod{10}$$
Notice that we can now pair each digit and form geometric progressions:
$$\begin{align*}&\quad(1^1+\cdots +1^{2001})+(2^{2}+\cdots +2^{2002})+\cdots+(9^{9}+\cdots +9^{2009})\\[7pt]&=1(1^0+1^{10}+\cdots+1^{2000})+2^2(2^0+2^{10}+\cdots+2^{2000})+9^9(9^0+9^{10}+\cdots 9^{2000})\\[7pt]\end{align*}$$
Rather than writing out the geometric series compactly, let's take it each separately:
$$1^0+1^{10}+\cdots+1^{2000}\equiv 201\equiv 1\pmod{10}$$
$$2^0+2^{10}+\cdots+2^{2000}\equiv 1+\underbrace{4+6+4+\cdots +6}_{200}\equiv 1\pmod{10}$$
$$3^0+3^{10}+\cdots+3^{2000}\equiv 1+\underbrace{9+1+9+\cdots +1}_{200}\equiv 1\pmod{10}$$
$$\cdots$$
$$9^0+9^{10}+\cdots+9^{2000}\equiv 1+\underbrace{1+1+1+\cdots +1}_{200}\equiv 1\pmod{10}$$
Now back to the original expression, we are left with:
$$1+2^2+\cdots+9^9\equiv 7\pmod{10}$$
We have a few more terms to consider, namely:
$$1^{2011}+2^{2012}+3^{2013}+4^{2014}\equiv 6\pmod{10}$$
Hence:
$$\sum_{k=1}^{2014} k^k\equiv 3\pmod{10}$$
(I have left out some of the more trivial computations to avoid clogging this answer with tedious modular arithmetic)
Hint: You can work directly modulo $10$, or modulo $5$, since the sum modulo $2$ is clear.
The value of $a^b$ modulo $p$, for fixed $b$, cycles nicely. By Fermat's Theorem, or Euler's Theorem, there is also nice cycling for fixed $a$ and variable $b$. Putting these things together, you should be able to detect and prove cycling in the value of $k^k$ modulo $5$ or $10$.
As $\phi(10)=4,a^4\equiv1\pmod{10}$ if $(a,10)=1$ using Euler's Theorem
Also observe that $2^{4r+s}-2^s=2^s(16^r-1)\equiv0\pmod{10}$ for $r\ge0,s\ge1$
Similarly, $4^{2r+s}-4^s=4^s(16^r-1)\equiv0\pmod{10}$ for $r\ge0,s\ge1$
and $6^{r+s}-6^s=6^s(6^r-1)\equiv0\pmod{10}$ for $r\ge0,s\ge1$
and $8^{4r+s}-8^s=8^s(16^{2r}-1)\equiv0\pmod{10}$ for $r\ge0,s\ge1$
So, $(2b)^{4r}\equiv6\pmod{10}$
So, the period of the powers is $4$
Now, the size of the complete residue $\pmod{10}$ is $10$
So, $\sum_{r+1\le k\le r+20}k^k$ will have the same modulus $\pmod{10}$ for al integer $r\ge0$ as $(10,4)=20$
$\sum_{k=1}^{2014} k^k\equiv 100\sum_{1\le k\le 20}k^k+\sum_{2001\le k\le 2014}k^k\pmod{10}$
$\equiv \sum_{1\le k\le 14}k^k\pmod{10}$ as $2000\equiv0\pmod{20}$
$\equiv (1^1+1^3)+(2^2+2^4)+(3^1+3^3)$ $+(4^2+4^4)+5^5+6^6+7^7+8^8+9^9+10^{10} \pmod{10}$ as $1\equiv1\pmod 4,11\equiv3;2\equiv2,12\equiv0; 3\equiv3,13\equiv1$
$\equiv(2)+2^2(2^2+1)+3(3^2+1)+4^2(4^2+1)+5+6+7^3+6+9^1 \pmod{10}$ as $8^{4r}\equiv6\pmod{10}$
$\equiv2+0+0+6(7)+5+6+(3)+6+9\equiv3\pmod{10}$