We have to find the remainder of
$$32^{({32^{32}})}\mod 9$$
$\gcd(9,32)=1$ and by Euler's theorem we find $\phi(9)=9\cdot\frac{2}{3}=6$
Now
$$32\equiv5\mod 9 \ \\ 32 \equiv 2 \mod 6$$
$$\therefore32^{32}\equiv 2^{32}\mod 6$$
Now here comes a part where I am stuck. We know $2\equiv 2\mod 6$,
hence $2^{32}\equiv2^{32}\mod 6 \\ \Rightarrow 2^{31}\equiv (-1)^{31}\equiv 2\mod 3$
Now if I multiply both sides by $2$, then will it be $2^{32}\equiv4\mod 3$
or $2^{32}\equiv4\mod 6$?I know that $a\cdot c\equiv b\cdot c \mod m$ but we don't multiply $m$ with $c$. Here I am little confused.
But I know the method to solve the whole but I am stuck in this little area.
Please help me. Any help is appreciated.
Another way without theorems. $$32^N=(27+5)^N\equiv5^N\pmod9\\32^{32}\equiv5^{32}\pmod9$$ $$\begin{cases}5^1\equiv5\pmod9\\5^2\equiv7\pmod9\\5^3\equiv8\pmod9\\5^4\equiv4\pmod9\\5^5\equiv2\pmod9\\5^6\equiv1\pmod9\end{cases}\Rightarrow \begin{cases}5^6\equiv1\pmod9\\5^9\equiv8\pmod9\\5^{9(2n+1)}\equiv8\pmod9\\5^{9(2n)}\equiv1^\pmod9\end{cases}$$ It follows $$5^{32}=5^{30+2}\equiv5^2\equiv7^\pmod9\iff5^{32}=7+9M$$ So we have $$32^{32^{32}}=32^{7+9M}\Rightarrow\text{$M$ is odd }$$ It follows $$32^{32^{32}}=5^{7+9(2n+1)}=5^7\cdot8\equiv5\cdot8\equiv\color{red}{4}\pmod9$$