0

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!

gt6989b
  • 54,422
  • 7
    Hint: $8\equiv -1\pmod 9$. – lulu Nov 27 '18 at 19:13
  • For this one, 8^126=(-1)^126=1 mod 9. In general, if your base is coprime to the modulo, you can use Euler's theorem (generalization of Fermat little theorem) to bring down the power: a^phi(n)=1 mod n for (a,n)=1. – Yifeng Huang Nov 27 '18 at 19:13
  • For example, 10^1000 mod 23? Since 10^22=1 mod 23 by Fermat little theorem, so 10^1000=10^10 mod 23 (take remainder of 1000 divided by 22). Now compute 10^2, 10^4, 10^8 by repeated square. Then 10^2 * 10^8 does the job. – Yifeng Huang Nov 27 '18 at 19:15

0 Answers0