-2

I know that

$$\tag{*}\boxed{\text{If }\gcd(a,n)=1, \text{then }a^{\varphi(n)}\equiv1\pmod{n}}$$

Also, more generally,

$$\tag{**}\boxed{\text{If }\gcd(a,c)=1, \text{then }a^b\pmod{c}\text{ reduces to }a^{b\pmod{\varphi(c)}}\pmod{c}}$$


I am sure about $(*)$, but not sure about $(**)$.

Here are some examples of $(**)$:

$6^{987}\pmod{35}$ reduces to $6^{987\pmod{24}}\pmod{35}$ which is $6^3\pmod{35}$ which is $216\pmod{35}$ which is $6$

Lets say $(**)$ is correct, then $6^{987}\equiv6\pmod{35}$ is correct.


I was trying to solve this question by $(**)$.

$17^{198}\pmod{100} \implies(**)\implies17^{198\pmod{\varphi(100)}}\pmod{100}\implies17^{198\pmod{40}}\pmod{100}$

$\implies 17^{38}\pmod{100}$

But I stuck what to do next since the exponent is already less than $\varphi(\text{divisor})$


How can I continue, effectively fast, from this step (without Carmichael function) and (with avoiding the use of negative integers)?

I am not pointing to that specific problem, but I am asking about an effective way when the exponent is already less than the phi value.


Your help would be appreciated. Thanks

Bill Dubuque
  • 282,220
Hussain-Alqatari
  • 5,738
  • 3
  • 16
  • 44

3 Answers3

0

An easy strategy is to pick a number closest to the exponent that you want to reach which has a lot of small factors. For example, you can get $a^{12}$ by calculating $((a^2)^2)^3) \pmod b$.

Thankfully, $36$ has a lot of small factors. $17^4\equiv 21 \pmod {100}$. Now, we can get $21^3\equiv 61 \pmod{100}$ and $61^3 \equiv 81 \pmod{100}$. This gives that $17^{36}\equiv 81 \pmod{100}$. Multiply this with $17^2\equiv 89\pmod{100}$ and get $17^{38}\equiv 9 \pmod{100}$.


In general, trying to get $a$ into smaller values, either positive or negative, is the easiest way to obtain remainder. There's a reason we use Fermat's little theorem because $1$ is the easiest number to exponentiate.

Umesh Shankar
  • 3,391
  • 1
  • 6
  • 23
  • 1
    Please strive not to post more (dupe) answers to dupes of FAQs. This is enforced site policy, see here. – Bill Dubuque Jan 02 '25 at 18:57
  • @BillDubuque, I believe I was answering the following question 'How can I continue, effectively fast, from this step (without Carmichael function) and (with avoiding the use of negative integers)' of the OP, which has not been explicitly addressed so far. I understand that the linked question has a lot of answers for the original question the OP was trying to solve. Anyway, I will keep an eye out in the future. – Umesh Shankar Jan 03 '25 at 09:17
0

According to the Fermat-Euler Theorem (or simply Euler's Theorem): $$a^{\phi(c)} \equiv 1\pmod c$$ because we're given that $\gcd(a, c) = 1$. WLOG, suppose that $b = \phi(c)q + r$, where $r = b\bmod\phi(c)$. Thus: $$a^b = a^{\phi(c)q + r} = \left(a^{\phi(c)}\right)^q \cdot a^r \equiv a^r\pmod c$$ Q.E.D. $\blacksquare$

Pardon me for using $\phi$ instead of $\varphi$, but I prefer $\phi$ over the other to avoid confusion. Anyways, good luck solving that problem!

0

Suppose $\gcd(a,c)=1$, and suppose that $b\equiv d\pmod{\varphi(n)}$. Then we can write $b=d+q\varphi(n)$ for some $q$, and suppose without loss of generality that $q\geq0$. It follows then, by applying Euler's theorem, that

$$a^b=a^{d+q\varphi(n)}=a^d\cdot (a^{\varphi(n)})^q\equiv a^d\cdot1^q=a^d\pmod{c}.$$

This shows your second claim.

Lorago
  • 12,173