<s>[INST] Find $ \ \ 8^{504} \equiv \pmod 5$ Find $ \ \ 8^{504} \equiv \pmod 5 $
Answer:
$ 8^{504} \equiv 2^{1512} \pmod 5 $
Now , 
$$ \begin{align}2^4 &\equiv 1 \pmod 5 \\\text{or, } \left(2^{4}\right)^{378} &\equiv 1^{378} \pmod 5 \\ \text{or, } 2^{1512} &\equiv 1 \pmod 5\\\text{or, } 8^{504} &\equiv \ 1 \pmod 5 \end{align}$$
Am I right ?
 [/INST] As $gcd(8,5)=1$ so by Euler's theorem $8^4\equiv 1\pmod5$ as $\phi (5)=4$ Now 504 divide by 4 so $8^{504}\equiv 1\pmod 5$
</s>