-2

What is the remainder of $\,3^{3^{3^{\:\!\phantom{}^{.^{.^.}}}}}\!\!\!$ divided by $46$? The level of powers is $2020$.

First there is no parenthesis so it means 3 power of 3 which is also power 3 and so on 2020 times

Second I think that we can use Fermat's Little Theorem but I don't know how, and maybe there is a better way.

Bill Dubuque
  • 282,220
Hou Sam
  • 27

2 Answers2

1

We can easily apply Euler's totient theorem here several times

$\varphi(46)=\varphi(2)\varphi(23)=22$

$\varphi(22)=\varphi(2)\varphi(11)=10$

$\varphi(10)=\varphi(2)\varphi(5)=4$

$\varphi(4)=2$

$\varphi(2)=1$

since they are all coprime to $3$. This gives the result:

\begin{align}R&=3\widehat~(3\widehat~(3\widehat~(3\widehat~(3\widehat~n))))\bmod46\\&=3\widehat~(3\widehat~(3\widehat~(3\widehat~(3\widehat~(n\bmod1)\bmod2)\bmod4)\bmod10)\bmod22)\bmod46\\&=3\widehat~(3\widehat~(3\widehat~(3\widehat~(3\widehat~1\bmod2)\bmod4)\bmod10)\bmod22)\bmod46\\&=3\widehat~(3\widehat~(3\widehat~(3\widehat~1\bmod4)\bmod10)\bmod22)\bmod46\\&=3\widehat~(3\widehat~(3\widehat~3\bmod10)\bmod22)\bmod46\\&=3\widehat~(3\widehat~7\bmod22)\bmod46\\&=3\widehat~9\bmod46\\&=41\end{align}

for any value of $n$.

0

Power tower mods are all resolvable by iteratively applying MOR = modular order reduction.

$\!\!\bmod 23\!:\,\ 3^{\large 11}\!\equiv 1\,\Rightarrow\, 3^{\Large 3^{\Large 3^{\Large 3^n}}}\!\!\!\!\!\! \equiv 3^{\Large\color{#c00}{3^{\Large 3^{\Large 3^n}}\!\!\!\!\bmod 11}}\!\equiv 3^{\large\color{#c00}9}\equiv 18\ $ by MOR, by

$\!\!\color{#c00}{\bmod 11}\!:\,\ \ 3^{\large 5}\equiv 1\,\Rightarrow\,\color{#c00}{3^{\Large 3^{\Large 3^n}}}\!\!\equiv 3^{\Large\color{#0a0}{3^{\Large 3^n}\!\bmod 5}}\equiv 3^{\large\color{#0a0}2}\equiv\color{#c00}9\, $ by ditto, by

$\!\!\color{#0a0}{\bmod 5}\!:\ \ \ \ \ 3^{\large 4}\equiv 1\,\Rightarrow\ \color{#0a0}{3^{\Large 3^n}}\!\equiv\ 3^{\Large 3^n\bmod 4}\equiv 3^{\large 3}\equiv\color{#0a0}2,\ \ {\rm by}\ \bmod 4\!:\! \smash{\overbrace{3^n \equiv 3}^{\!\!\large (-1)^{\Large n}\, \equiv\ -1}}\!\!\!,\ {\rm by}\ n\ \rm odd$

Hence $\,n\,$ odd $\,\Rightarrow\, x:= 3^\smash{\Large 3^{\Large 3^{{\Large 3^n}}}}\!\!\!\!\!\equiv 18\pmod{\!23},\,$ so $\,x\,$ odd $\Rightarrow\, x\equiv 18\!+\!23\equiv 41\pmod{\!46}$

For $\,n\,$ even we get $\, \color{#0a0}{3\pmod{\! 5}},\,$ so $\,3^{\large \color{#0a0}3}\equiv\color{#c00}{5\pmod{\! 11}},\:$ so $\,\ x\equiv 3^{\large\color{#c00}5}\equiv 13\pmod{\!23\ \&\ 46}$

Hence, more generally $\,\ \bbox[1px,border:1px solid #0a0]{\bbox[8px,border:1px solid #050]{\!\!\bmod 46\!:\,\ 3^{\Large 3^{\Large 3^{{\Large 3^n}}}}\!\!\!\equiv\, \left\{\begin{align} &41,\ \,n\,\ \rm odd\\ &13,\ \,n\,\ \rm even\end{align}\right.}}$

Bill Dubuque
  • 282,220
  • We used $ \bmod 23!:, \left[3\equiv 7^{\large 2}\right]^{\large 11}!!\Rightarrow, 3^{\large 11}\equiv 7^{\large 22}\equiv 1.,$ Similarly $!\color{#c00}{\bmod 11},$ using $,3\equiv 6^2\ \ $ – Bill Dubuque Feb 25 '20 at 02:43
  • Note $ $ The same method works for any height power towers, but we may need to additionally apply the mod distributive law (or CRT) when the base is not coprime to the modulus, e.g. see here and here – Bill Dubuque May 19 '20 at 22:10