Hello Sir,
This is my code to find the remainder when an exponent is divided by an integer, using binary exponentiation with remainderisation at each recursion(step).
Sometimes a^b becomes so large that it is not possible for us to first evaluate it and then find the remainder when it is divided by any integer. So for large b, we use binary exponentiation with remainderisation at each step to evaluate remainder without evaluating actual number.
we will use following property of remainder:
(ab)%c=((a%c)(bc))c)
Hello Sir, This is my code to find the remainder when an exponent is divided by an integer, using binary exponentiation with remainderisation at each recursion(step).
Sometimes a^b becomes so large that it is not possible for us to first evaluate it and then find the remainder when it is divided by any integer. So for large b, we use binary exponentiation with remainderisation at each step to evaluate remainder without evaluating actual number.
we will use following property of remainder: (ab)%c=((a%c)(bc))c)