To clarify a bit ...
(a * b) mod m == ((a mod m) * (b mod m)) mod m
If you recall the basic math,
a ^ 10 = (a ^ 5) * (a ^ 5)
So, you can divide your crazy higher forces into lower forces, and then take their value modulo (thereby keeping the value small), and then recombine them later:
Too Big! = Just Right!
(2 ^ 20) mod 113 = (((2 ^ 10) mod 113) * ((2 ^ 10) mod 113)) mod 113
I donβt know if this is considered a "distribution", but my students had problems with it once, and I had no problems showing them this trick. In addition, I believe this is more of a recursion exercise than anything else.
source
share