# How to evaluate $3^{123}\!\bmod 3\,$ and $5^{123}\! \bmod 2$ and similar? [closed]

I hope someone can explain me how to solve modulo -equations ,e.g.

$$5^{123} \mod 2$$

It was a little bit overwhelming for me to get a feeling for solving such equations.I don't how and when i have to use one of these great theorems like, Fermat's little ,Euler totient function,Chinese remainder theorem a.s.o.So I decide to ask you guys for helping me with my stacks.

• In this case , the result is obvious : $0$ – Peter Sep 21 '19 at 19:54
• Tip for the general case : Use the chinese remainder theorem and the Euler theorem (sometimes Fermat's little theorem is already sufficient) – Peter Sep 21 '19 at 19:56
• Ok,you are right.It is a bit trivial example. – Gui Sep 21 '19 at 19:58
• Maybe 5^123 mod 2 should be better. – Gui Sep 21 '19 at 19:59
• @Gui Since this one is closed, I posted in another similar one, vote if you like math.stackexchange.com/a/3364841/399263 – zwim Sep 21 '19 at 20:40

The answer is pretty obvious: it is $$0$$ ($$3^n$$ where $$n$$ is a positive integer obviously divides $$3$$ and thus has a remainder of $$0$$). If you were asking for$$\pmod{10}$$, then we would apply Euler's Totient's Function, $$\phi(n)$$ and then simplify from there. For your next question, since $$5\equiv 1\pmod 2$$, we have that $$5^{123}\equiv 1^{123}\equiv 1\pmod{2}.$$
• I will try it for $5^{123}$ mod 10: – Gui Sep 21 '19 at 20:16