We define the sequence of natural numbers $$ a_1 = 3 \quad \text{and} \quad a_{n+1}=a_n^{a_n}, \quad \text{ for $n \geq 1$}. $$
I want to show that the last digit of the numbers of the sequence $a_n$ alternates between the numbers $3$ and $7$. Specifically, if we symbolize with $b_n$ the last digit of $a_n$, I want to show that $$ b_n = \begin{cases} 3, & \text{if $n$ is odd}, \\ 7, & \text{if $n$ is even}. \end{cases} $$
There is a hint to prove that for each $n \in \mathbb{N}$, if $a_n \equiv 3 \pmod{5}$ then $a_{n+1} \equiv 2 \pmod{5}$ and if $a_n \equiv 2 \pmod{5}$ then $a_{n+1} \equiv 3 \pmod{5}$.
First of all, if we take $a_n \equiv 3 \pmod{5}$, then $a_{n+1}=3^3\pmod{5} \equiv 2 \pmod{5}$.
If $a_n \equiv 2 \pmod{5}$, then $a_{n+1}=2^2 \pmod{5}=4$. Or am I doing something wrong?
And also how does it follow, if we have shown the hint, that $b_n$ is $3$ when $n$ is odd, and $7$ if $n$ is even?