Can you provide a link to the problem?
My friend! I have a question. If a and c arenāt coprime, it means that there is a prime (let it is pi) that a % pi == 0 && c % pi == 0, and pi is in the set of prime (we break c), and when we apply above formula, we canāt calculate value of ((a % pi) ^ (b % phi(pi))) % pi (because gcd(a, pi) > 1) (after calculate, we can use CRT to calculate the answer). Could you tell me more about that? Thank you in advance
The language for above problem is Vietnamese, do you want to get the link?
I donāt know the question requiring, just understand that: "calculate a^b % c "
if a % p = 0, then a^n % p will always be zero.
1 Like
Oh :D, thank you
Donāt you think your if-else ladder for even exponent is very inefficient ?