The answer is $4$. I saw someone answered in $5$ seconds. How did they do that?
What is $2018^{2018}$ mod $20$?
1.1k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 5 best solutions below
On
It suffices to find the residues mod $4$ and mod $5$. Since $2018$ is even, $2018^{2018}$ is a multiple of $4$, so $2018^{2018} \equiv 0 \pmod 4$.
To find the residue modulo $5$, note that $2018 \equiv 3 \pmod 5$, so $$2018^{2018} \equiv 3^{2018} \pmod 5$$ Fermat's little theorem says that $3^4 \equiv 1 \pmod 5$, so $$3^{2018} \equiv 3^{4*504 + 2} \equiv 3^2 \equiv 4 \pmod 5$$ Hence $2018^{2018} \equiv 0 \pmod 4$ and $2018^{2018} \equiv 4 \pmod 5$. By the Chinese remainder theorem there is exactly one residue class modulo $20$ satisfying these relations. Since $4 \pmod {20}$ is easily seen to satisfy them, we conclude that $2018^{2018} \equiv 4 \pmod {20}$.
Note that if I hadn't immediately noticed the correct answer at the end, I could have successively tried numbers of the form $4 + 5k$ until finding the one that is $0 \pmod 4$.
Some people can do these calculations in their head really fast, which is probably what the person you mentioned did.
On
Since $2018 \equiv -2 \pmod{20}$ we have $$2018^{2018} \equiv (-2)^{2018} \equiv 4^{1009}\pmod{20}$$ and then $$4^1 \equiv 4 \pmod{20} \\ 4^2 = 16 \equiv -4 \pmod{20} \\ 4^3 \equiv -4\cdot 4 \equiv 4 \pmod{20} \\ \vdots$$
Since $1009$ is odd and the powers of $4$ alternate $4, -4, 4, -4, \ldots$, the answer is $4.$
On
Note $\ 18^{\large 2+4n}\:\!\!\bmod 20\, =\, \color{#c00}{2^{\large 2}}\:\!(\!\!\overbrace{\color{#0a0}9^{\large 2} \color{#90f}{18}^{\large 4n}\bmod 5}^{\!\!\!\large (\color{#0a0}{-1})^{\Large 2} (\color{#90f}{-2})^{\Large 4\:\!n}\equiv\ 1\,\cdot\, 1^{\large n}}\!\!) \,=\,{\bbox[4px,border:1px solid black]{\color{#c00}{2^{\large 2}}}}$
by using $\ \ \ ab\:\!\bmod ac\, =\, \color{#c00}a\,(b\bmod c) = $ $\bmod$ Distributive Law to factor out $\ \color{#c00}{a = 2^{\large 2}}$
Remark $ $ It is instructive to examine how this is related to the other answers using CRT. The above rule is a convenient operational way to solve $\,x\equiv 0\pmod{\!4},\,$ $x\equiv 4\pmod{\!5},\,$ namely we have $\, 4\mid x\,\Rightarrow\,x\bmod 20 = 4(x/4\bmod 5) = 4(-x\bmod 5)\,$ $[=4(1)\,$ if $\,x\equiv 4\pmod{\!5}],\,$ achieved by simply factoring out $\,\color{#c00}4\,$ (vs. less convenient CRT methods).
Or, note $\,x\equiv 0\equiv 4\pmod{\!4}\,$ so by CCRT $\,x\equiv 4\pmod{\!4,5}\iff x\equiv 4\pmod{\!20}.\,$ But that won't work as generally as above. Note mDL = mod Distributive Law is actually equivalent to CRT, as is explained in the final paragraph here). There are over $75$ worked examples of mDL here, which highlight the simplifications it yields.
On
Outline:
Let $x\equiv2018^{2018}\pmod{20}$.
By the Chinese remainder theorem, we can do this if we can compute the residues mod $4$ and $5$ respectively.
Mod $4$ it's $0$. Mod $5$ it's $4$ (by Fermat's little theorem).
Bezout coefficients for $5$ and $4$ are $1$ and $-1$ ($1\cdot5+-1\cdot4=1$).
Then it follows that $x=1\cdot4+-1\cdot0=4$.
Granted this takes a minute or two.
Mod $5$: $2018^{2018}\equiv(3^4)^{504}3^2\equiv1\cdot3^2=9\equiv4$.
Mod $4$: any even number to a power at least $2$ is $0$.
By the Chinese remainder theorem, therefore, it is a residue modulo $20$ that is $4$ mod $5$ and $0$ mod $4$.
Modulo $20$, the residues that are $4$ mod $5$ are $4, 9, 14, $ and $19$,
and it takes just a few seconds to see which one of those is $0$ mod $4$.