I am trying to find the last digit of $3^{5^7}$ (or $3^{(5^7)}$, if you will) using modular exponentiation. Here's what I've figured out:
The value I want is $3^{5^7} \mod 10$.
$5^n \mod 10 = 5$ (if $n$ is a positive natural number).
The residues of $3^n \mod 10$ repeat themselves every time $n$ increases by $4$. The pattern is $1, 3, 9, 7, 1, 3, 9, 7, \ldots$ for $n = 0, 1, 2, 3, 4, 5, 6, 7, \ldots$
Now, I don't know how to use these facts to get what I need. I know that the answer $3$ (via WolframAlpha) but I don't know how to connect the dots here. Any help would be appreciated.
Thanks!
You noticed that $3^n \equiv 3^m \pmod{10}$ if $n \equiv m \pmod{4}$. How about computing $5^7 \pmod 4$? If you can reduce $5^7 \equiv k \pmod 4$ for some $k \in \{0,1,2,3\}$, then $3^{(5^7)} \equiv 3^k \pmod{10}$ and you have your answer. I will leave you the pleasure of computing since you seem able to do so.
Hope that helps,