I'm taking my first steps into modular arithmetic and I'm already stuck.
Calculate:
$$177^{20^{100500}}\pmod{60}$$
I don't know how to tackle this one. So far I've been applying Euler's Theorem and Fermat Little Theorem to compute more simple expressions, but here we notice that $\mathrm{gdc}(177,60) = 3 \neq 1$ so, to my understanding, I can't apply any of the two theorems. I tried the following instead:
\begin{align} 177^{20^{100500}} \pmod{60} &\equiv (3\cdot 59)^{20^{100500}}\bmod 60\\ &\equiv (3 \bmod 60)^{20^{100500}} \cdot (59\bmod60)^{20^{100500}}\\ &\equiv (3 \bmod 60)^{20^{100500}} \cdot (-1)^{20^{100500}} \end{align}
Since $20^{n}$ is even $\forall n \in \mathbb{N}$ then $(-1)^{20^{100500}} = 1$. Therefore
$$177^{20^{100500}} \pmod{60}\equiv 3\ (\mathrm{mod}\ 60)^{20^{100500}}$$
But I have no idea what to do here.
Thanks for your help.
You got off to a good start there.
You know about Euler's Theroem, and Euler's totient, so I can add another tool to the box with the Carmichael function $\lambda$ which will give you the largest exponential cycle length (and still a value that all shorter cycles will divide). This combines prime power values through least common multiple rather than simple multiplication as for Euler's totient.
Here $\lambda(60) ={\rm lcm}(\lambda(2^2),\lambda(3),\lambda(5)) ={\rm lcm}(2,2,4) =4$. So for any odd number $a$, since there are no higher odd prime powers in $60$, you will have $a^{k+4}\equiv a^k \bmod 60$ for $k\ge 1$. (For even numbers you might need $k\ge 2$, since $2^2 \mid 60$). So $20^{100500}$ is just a huge multiple of $4$, and we can cast out all those $4$s all the way down to $3^4$. So the final result is
$$177^{20^{100500}} \equiv \underset {(\text{your result})}{3^{20^{100500}}}\equiv \underset {(\lambda(60)=4)}{3^4}\equiv 81\equiv 21 \bmod 60 $$