374 - Big Mod
A text book problem.
We are asked to compute . Using Repeated Squaring, we can calculate efficiently, so long as the individual multiplications aren't expensive. Just our luck, the modulus in the expression will keep the final result low. We can use the relation that to keep the intermediate results small. Thus, we can use a basic integer to hold intermediate results, and never have to resort to BigNum multiplications.
3 18132 17 17 1765 3 2374859 3029382 36123
13 2 13195