I am having trouble in understanding how this code is giving the correct answer for larger test cases (TL > limit of long long int). Suppose TL = 83478347589347598347598347598347983475983475983475893475983475893475 and N = 348573894578934759834759834759834798327498237498237498237498327482397492384, the above code will give a = 159184929 and b = 749176548. Now we'll calculate a^b % MOD instead of directly calculating TL^N % MOD. How is a^b % MOD == TL^N % MOD?
↧
Modular Exponentiation and large numbers
↧