Last digit of sequence of numbers 
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?

It follows directly from the hint:
The last digit of $a_n$ is the residue class of $a_n$ mod 10. 
Now if you have $a_n \equiv 3 \textrm{ (mod 5)}$ it follows $a_n \equiv 3 \textrm{ (mod 10)}$ or $a_n \equiv 8 \textrm{ (mod 10)}$. But $a_n \equiv 8 \textrm{ (mod 10)}$ would mean that $a_n$ is even, so $2$ comes in the prime factorization of $a_n$, but the only prime dividing $a_n$ is 3, so this is not possible.
In the same way, from $a_n\equiv 2\textrm{ (mod 5)}$ you get $a_n \equiv 7\textrm{ (mod 10)}$.
