Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Why does the following identity hold $$R_m(a^x)=R_m(a^{R_{\phi(m)}(x)})$$ where $R_m(a)$ is the remainder of $a$ divided by $m$, also denoted $a \mod m$, and $\phi(m)$ is Euler's totient function.

It is useful for calculating remainders of large numbers very quickly by hand, e.g. $R_{990}(5^{722})$.

share|cite|improve this question
up vote 1 down vote accepted

It only holds if $a$ is relatively prime to $m$, i.e. if $\gcd(a,m)=1$.

To see a counterexample when this is not the case note that, if we choose $a=2$, $m=16$, and $x=9$, we have $R_m(a^x)=R_{16}(2^9)=0$, but $\phi(m)=\phi(16)=8$, so that $$R_m(a^{R_{\phi(m)}(x)})=R_{16}(2^{R_{8}(9)})=R_{16}(2^1)=2.$$ However, when $a$ is relatively prime to $m$, then Euler's theorem states that $a^{\phi(m)}\equiv 1\bmod m$, and therefore $a^{k\phi(m)}\equiv 1^k\equiv 1\bmod m$ for any $k\geq 0$. By the division algorithm, for any integer $x$ there is a $k$ such that $$x=k\phi(m)+R_{\phi(m)}(x),$$ and therefore $$a^x=a^{k\phi(m)+R_{\phi(m)}(x)}=a^{k\phi(m)}\cdot a^{R_{\phi(m)}(x)}\underset{\text{mod }m}{\equiv}1\cdot a^{R_{\phi(m)}(x)}=a^{R_{\phi(m)}(x)}.$$ Because these two numbers are equivalent modulo $m$, their respective remainders after dividing by $m$ are equal, so that $$R_m(a^x)=R_m(a^{R_{\phi(m)}(x)}).$$

share|cite|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.