<s>[INST] How to calculate $14^{2017^{2017}} \mod 60$? $14^{2017^{2017}} \mod 60$
So, I know that I should begin with decomposing $60$ to the prime factors, which are: $ 3, 2^2, 5$, now I should calculate $14^{2017^{2017}} mod$ all three of these prime factors.
My question is, what is the easiest way of calculating $14^{2017^{2017}} \mod 3$?
 [/INST] Sketch:
Since $14\equiv 2\pmod 3$, 
$$14^{2017^{2017}}\equiv 2^{2017^{2017}}\pmod 3.$$
Now, we know that the powers of $2$ satisfy
\begin{align*}
2^1=2&\equiv 2\pmod 3\\
2^2=4&\equiv 1\pmod 3\\
2^3=8&\equiv 2\pmod 3\\
2^4=16&\equiv 1\pmod 3\\
2^5=32&\equiv 2\pmod 3
\end{align*}
and so on.
In other words, since $2^2\equiv 1\pmod 3$, we only need to compute the power modulo $2$.  Since $2017^{2017}\equiv 1^{2017}\equiv 1\pmod 2$, we know that the power on $2$ is odd.  Hence
$$
14^{2017^{2017}}\equiv 2^{2017^{2017}}\equiv 2^1\equiv 2\pmod 3.
$$
</s>