4. Find the last digit of the number $A=12^{12}+22^{22}+32^{32}+\cdots+(10 \cdot 2016+2)^{10 \cdot 2016+2}$.

Andrei Caţaron
## Solution.

The terms of the sum $A$ are of the form $(10 n+2)^{10 n+2}$, with $n \in\{1,2,3, \cdots, 2016\}$. (1p)

We denote by $u(a)$ the last digit of a natural number $a$ represented in base 10.

For $a, m \in \mathbb{N}^{*}$, such that $u(a)=2$, we have

$$
u\left(a^{m}\right)=u\left(2^{m}\right)=\left\{\begin{array}{l}
6, \text { if } m=4 k \\
2, \text { if } m=4 k+1 \\
4, \text { if } m=4 k+2 \\
8, \text { if } m=4 k+3
\end{array}, k \in \mathbb{N} .(2 p)\right.
$$

Thus,

$$
u\left((10 n+2)^{10 n+2}\right)=u\left(2^{2(5 n+1)}\right)=\left\{\begin{array}{l}
6, \text { if } n \text { is odd } \\
4, \text { if } n \text { is even }
\end{array}\right.
$$

Since $n$ takes 1008 even values and 1008 odd values, we obtain $u(A)=u(1008(6+4))=0$. (2p)