Im trying to find 2018^2018 mod 20. Are there rules to help with this? I know a^b = c^b mod 20 if a=c mod 20, so you can do 18^2018 mod 20, but I dont know where to go from there.
$$20=2^2\cdot 5$$
$$\phi(20)=8$$
This means:
$$\forall x,r \in \mathbb{Z}, r>0 , x^{8k+r} \equiv x^r \pmod{20}$$
So you have:
$$2018 \equiv 18 \pmod{20}$$
$$2018 \equiv 2\pmod{8}$$
So, this gives:
$$2018^{2018} \equiv 18^2 \pmod{20}$$