Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

Modular Exponentiation and large numbers

$
0
0

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?


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>