# How do evaluate $x = (5^2 \bmod 6)^4 \bmod 15?$

$x = (5^2 \bmod 6)^4 \bmod 15$.

I wanted to turn $(5^2 \bmod 6)^4 \bmod 15$ into a constant, but I just lost hope when I saw how humongous the expression was.

-
Humongous? Is $1$ humongous? Maybe to a creature of size $10^{-4}$. –  André Nicolas Nov 29 '12 at 22:35
if you had 625, you could do 625-6x10 and do the same thing? –  internetlearning Nov 29 '12 at 22:39
@internetlearning, yes $6 = 0 \mod 6$ so $600 = 0 \mod 6$ so $625 = 25 \mod 6$. –  user50336 Nov 29 '12 at 22:40
@internetlearning you should start thinking about accepting answers you find helpful. –  amWhy Nov 30 '12 at 2:16

$$\begin{eqnarray} && (5^2 \bmod 6)^4 \bmod 15 \\ &=& (25 \bmod 6)^4 \bmod 15 \\ &=& (19 \bmod 6)^4 \bmod 15 \\ &=& (13 \bmod 6)^4 \bmod 15 \\ &=& (7 \bmod 6)^4 \bmod 15 \\ &=& (1 \bmod 6)^4 \bmod 15 \\ &=& 1^4 \bmod 15 \\ &=& 1 \bmod 15 \\ &=& 1 \end{eqnarray}$$
@internetlearning, yes because $0 = 6 \mod 6$ we have $x - 0 = x- 6 \mod 6$. –  user50336 Nov 29 '12 at 22:39
@internetlearning, by the way I would have actually done $5^2 = (-1)^2 \mod 6$ but I thought it's simpler this way when you are just learning about mod. –  user50336 Nov 29 '12 at 22:41
You can actually just directly compute $5^2 = 25$.
Now we have $(25 \bmod 6)^4 \bmod 15 = 1^4 \bmod 15 = 1 \bmod 15$