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?

First, you should prove that $a_n$ is odd for all $n$ : this follows from the fact that $a_1$ is odd, and if $a_n$ is odd, then $a_{n+1}=a_n^{a_n}$ is an odd number multiplied  with itself some number of times, so it is odd.

Let us notice something more. First, $a_1 = 3 \equiv 3 \mod 4$. Next, if $a_n \equiv 3 \mod 4$, then $a_{n+1} \equiv 3^{a_n} \equiv 3^1 \mod 4$ (as $3^2 = 9 \equiv 1 \mod 4$, we may take remainder when $a_n$ is divided by $2$, and this is $1$ since $a_n$ is odd).
Thus, $a_n \equiv 3 \mod 4$ for all $n$.

To the main part.
If $a_n \equiv 3 \mod 5$,  then $a_{n+1} = a_n^{a_n} \equiv 3^{a_n} \mod 5$ is all you can say using the fact that $a_n \equiv 3 \mod 5$. But note that $3^{4} \equiv 1 \mod 5$, so you can now say that $a_{n+1} \equiv 3^{(a_n \mod 4)} \mod 5$.
But the point is, that $a_n$ is odd, so $a_n \mod 4$ is either $1$ or $3$.  Consequently, $a_{n+1} \equiv 3^1 = 3 \mod 5$ or $a_{n+1} \equiv 3^3 = 27 \mod 5$ must happen. We appear somewhat stuck here. Let me relieve you : we are doing fine.

With the above observation combined with the second part, we have $a_{n+1} \equiv 27 = 2 \mod 5$.
Now, if $a_n \equiv 2 \mod 5$, then $a_{n+1} \equiv 2^{a_n} \mod 5$, and again we equate this to $2^{a_n \mod 4} \mod 5 = 2^3 =8 \equiv 3 \mod 5$.
Thus, $a_{n+1} \equiv 3 \mod 5$.

So the remainders of $a_n$ and $a_{n+1}$ alternate modulo $5$. Since all $a_n$ are odd, this forces their last digits to alternate, and from knowing that the last digit of $a_1$ is $3$,  the sequence of last digits must go $373737373...$
