As part of my homework I am supposed to find the remainder of the division of $2^{{14}^{45231}}$ by $31$.
Using the ideas explained in calculating nested exponents modulo n I tried the following:
$\phi(31)=30$ since $31$ is prime. Then:
$2^{{14}^{45231}}$ (mod $31$) = $2^{{14}^{45231} (\textrm{mod}30)}$ (mod $31$)
Since $30 = 2 \cdot 3 \cdot 5 \quad $ I need to solve:
$$\begin{matrix} 14^{45231} \equiv a_1 \; (\textrm{mod} \; 2) \\ 14^{45231} \equiv a_2 \; (\textrm{mod} \; 3) \\ 14^{45231} \equiv a_3 \; (\textrm{mod} \; 5) \end{matrix}$$
That means to solve:
$$ \begin{matrix} x \equiv 0 \; (\textrm{mod} \; 2) \\ x \equiv -1 \equiv 2 \; (\textrm{mod} \; 3) \\ x \equiv -1 \equiv 4 \; (\textrm{mod} \; 5) \end{matrix}$$
Let $N = 30 = 2 \cdot 3 \cdot 5$; $n_1=2$; $n_2=3$; $n_3=5$, since $\textrm{gdc}(n_i,n_j) = 1 \; \forall i \neq j \; ; \; i,j \in (1,2,3)$, I can use the chinese remaider theorem which gives me that:
$$x = \sum_{i=1}^{3}a_i \cdot N_i \cdot y_i \; (\textrm{mod} \; n_1 \cdot n_2 \cdot n_3)$$
Where $N_i = \frac{N}{n_i}$; $y_i=N_i^{-1} \; (\textrm{mod} \; n_i)$; $a_1=0$; $a_2=2$ and $a_3=4$.
Applying the formula I found that: $x=44 \equiv 14 \; (\textrm{mod} \; 30)$
Going back to the beginning I made:
$2^{{14}^{45231}}$ (mod $31$) = $2^{{14}^{45231} (\textrm{mod}30)}$ (mod $31$) = $2^{{14}} \equiv 2^4 \equiv 16$ (mod $31$)
And because of that I can say that the remainder of the division of $2^{{14}^{45231}}$ by $31$ is $16$.
I have two doubts about this resolution:
1) Is it right? If not, could you please point out where I made a mistake?
2) Is there another way to solve nested exponents other than using Euler's Totient Function? Even better, is there any other way to solve this using less step's or arguments? (Despite of the obvious fact that they are valid answer's to the second question, I think its better to mention that I am not looking for answer's like: Yes, using Mathematica. (or similar ones))