A modular arithmetic question

49 Views Asked by At

I am a beginner in modular mathematics. I can't figure out is $$a^b \bmod m = (a \bmod m)^{(b \bmod m)} \bmod m$$

If this is the case, can you please give me some hint how to prove this?

Thanks!

2

There are 2 best solutions below

0
On

I think what you are asking is in effect, "if $a\equiv a_1\pmod m$ and $b\equiv b_1\pmod m$ then is $a^b\equiv a_1^{b_1}\pmod m$?"

The answer is no: $2\equiv 5\pmod 3$, but $2^2\not\equiv 5^5\pmod 3$.

5
On

The real relation is this: $$a^b\mod m\equiv(a\bmod m)^{b\bmod\varphi(m)}\mod m$$ as results from Euler's theorem ($\varphi$ is the totient function).

Example : by Fermat's theorem, if $p$ is prime, $\;a^b\equiv a^{b\bmod p-1}\mod p$.