Modulo for power

114 Views Asked by At

Question: calculate $8^{126} \pmod{9}$.

My try: $$ 8^2 \pmod{9} = 1\\ 8^3 \pmod{9} = 8\\ 8^4 \pmod{9} = 1\\ .... $$

So for every even power the modulo is 1, otherwise it's 8. However, what is the common path normally to follow when we have to deal with modulo power something?

Thank you!

I have no idea how to solve that problem, what path should i follow for modulo powers? thank you!