While performing some arithmetic operations, i am stuck at one point.I want to know is it possible to write ($a^b)\%p$ as ($a^{(b\%p)})\%p$?
Asked
Active
Viewed 29 times
-2
-
1No, you need to use the properties given in the dupes. You can find easy counterexamples your claim, e.g. apply it to little Fermat $,a^p\equiv a\pmod{p}\ \ $ – Bill Dubuque Sep 13 '20 at 21:09
1 Answers
1
The answer is no, and almost any randomly chosen set of values is a counterexample (for example, take $p=3$ and $a=2$ and $b=4$).
You're right to hope for some kind of reduction shortcut in the exponent. For that you should check out Fermat's little theorem and its generalization Euler's theorem.

Greg Martin
- 78,820