TITLE: How to calculate really big number mod 990
QUESTION [5 upvotes]: How to calculate $67^{26^{42^{23}}}\mod 990$?
My idea is to solve $x \equiv 42^{23}\mod 990$ then solve $26^x\mod 990$ and so on. But how to "compute" $42^{23}\mod 990$ only with a pencil and a sheet of paper?
Second idea is that we may factor $990$ into $2 \cdot 3^2 \cdot 5 \cdot 11$ and use chinese remainder theorem...

REPLY [7 votes]: First use the Chinese remainder theorem:
$$\mathbf Z/990\mathbf Z\simeq \mathbf Z/2\mathbf Z\times\mathbf Z/5\mathbf Z\times\mathbf Z/9\mathbf Z\times\mathbf Z/11\mathbf Z. $$
Now

$67\equiv1 \mod 2$,
$67\equiv2 \mod 5$, hence it has order $4$ modulo $5$,
$67\equiv4 \mod 9$, hence it has order $3$ modulo $9$
$67\equiv1 \mod 11$.

The order of $67$ modulo $990$ is the l.c.m. of its orders modulo $\;2,5,9$ and $11$: $\;\color{red}{12}$, and
$$67^{26^{42^{23}}}\mod 990=67^{26^{42^{23}}\bmod12}$$
Value of the exponent modulo 12:
First observe $26\equiv 2\mod 12$; it is easy to check that, if $n\ge 2$, 
$$2^n\equiv\begin{cases} 4\mod 12&\text{if $n$ is even,}\\8\mod 12&\text{if $n$ is odd.}
\end{cases}$$
We conclude that $26^{42^{23}}\equiv2^{42^{23}}\equiv 4 \mod 12$, and
$$67^{26^{42^{23}}}\equiv 67^4\equiv 661\mod 990.$$