4

I have to calculate

$$ 3^{{2014}^{2014}} \pmod {98} $$

(without calculus). I want to do this by using Euler/Fermat. What I already have is that the $\gcd(3, 98) = 1$ so I know that I can use the Euler Fermat formula.

Then I know that $\varphi(m = 98) = 42 $

Then I can say that

$$3^{{2014 }^{2014} \pmod {42}} \pmod {98}$$

Now I don't know how to progress. Any ideas/hints?

Somebody
  • 369

2 Answers2

3

Continue for $2014^{2014} \pmod{42} \equiv (2014 \pmod {42})^{2014} \equiv (-2)^{2014} \equiv 2^{2014} $

Chinese Remainder Theorem and Fermat's Little Theorem: $42 = 2 \times 3 \times 7 $

$ 2^{2014} \pmod 2 \equiv 0 \bmod 2 $

$ 2^{2014} \pmod 3 \equiv (-1)^{2014} \equiv 1 $

$ 2^{2014} \pmod 7 \equiv 2^{2014 \bmod \ 6} \equiv 2^4 \equiv 16 \equiv 2 $

CRT: $2^{2014} \pmod{42} \equiv 16 $

We are left with $3^{16} \pmod {98} $

Apply repeated squaring:

$ 3^{16} \equiv (3^4)^4 \equiv (-17)^4 \equiv 17^4 \equiv (17^2)^2 \equiv (-5)^2 \equiv \boxed{25} $

GohP.iHan
  • 1,376
  • Oh wow. I was working on a super-complicated approach, but this surpasses mine by far. – apnorton May 02 '15 at 20:30
  • Haha, yeah, we sometimes do the unnecessarily long approach without knowing it. +1 – GohP.iHan May 02 '15 at 20:57
  • Hello, thanks for your answer, it is really helpful! I only do not get how I know that 2^x mod 3 is congruent to -1 ^x and how 2^x mod 7 is con to 2^(x mod 6) . Could you explain this a little bit? – Somebody May 02 '15 at 21:01
  • @Somebody: Properties of modular arithmetic. 2^x mod 3 = (2 mod 3)^x = (-1)^x. And by Fermat's Little Theorem, because 2 and 7 are coprime, we could apply this theorem, 2^x mod 7 = 2^(x mod (7-1)) mod 7 = 2^(x mod 6) mod 7. – GohP.iHan May 02 '15 at 21:03
  • Oh I see, that's clever! Thank you again for your answer. :) – Somebody May 02 '15 at 21:06
2

Well, I had written almost all of this up, and then @GohP.iHan posted a much better/shorter approach. :) I'll go ahead and post in case someone else finds it useful, but you should use his way.

Your problem, now, is that you want to compute $2014^{2014}\pmod{42}$. We can factor 2014, which should make it easier: $$2014^{2014} = (2\cdot19\cdot53)^{2014}$$

So, we can use Euler/Fermat for $19^{2014}$ and $53^{2014}$:

\begin{align} 19^{2014}&\equiv 19^{2014\bmod \phi(42)}\pmod{42}\\ &\equiv 19^{2014\bmod 12}\\ &\equiv 19^{10}\\ &\equiv \left(19^{-1}\right)^2\equiv 31^2\\ &\equiv 37\pmod {42} \end{align} Note how I used that $9^{10}\equiv 19^{12}\cdot \left(19^{-1}\right)^2$; this saves me from having to do repeated-squares to evaluate the power. I use the same trick for $53^{2014}$ below: \begin{align} 53^{2014}&\equiv 11^{10}\pmod{42}\\ &\equiv \left(11^{-1}\right)^2\equiv 23^2\\ &\equiv 25 \pmod {42} \end{align}

Now we have that pesky $2^{2014}\pmod{42}$, where the exponent base isn't coprime to the modulus. At this point, I'll just say "use the CRT like @GohP.iHan did in his answer," because I wasn't sure how to approach that. You should have that $2^{2014} \equiv 16$.

Multiplying, we have an answer: $$2014^{2014} \equiv 16\cdot 37\cdot 25 = 14800 \equiv 16 \pmod 42$$

So, the final answer is $3^{16}\equiv 25\pmod {98} $

apnorton
  • 17,706