I was wandering if there was a trick here that I'm not aware. For example (large number):
6612384^8
How can I apply mod 10?
I was wandering if there was a trick here that I'm not aware. For example (large number):
6612384^8
How can I apply mod 10?
modular exponentiation can be a lot more efficient then regular exponentiation. Taking advantage of the fact that a^b mod c == (a mod c)^b mod c
, and using exponentiating by squaring,
6612384^8 mod 10 ==
4^8 mod 10 ==
16^4 mod 10 ==
6^4 mod 10 ==
36^2 mod 10 ==
6^2 mod 10 ==
36 mod 10 ==
6
All of which you could theoretically calculate even without a pen and paper.