Calculate the rest of the division of $(4^{103} + 2(5^{104}))^{102}$ by $13$ I already know some techniques to solve big exponents such as, Euler/Fermat Theorem,Euler/Carmichael,successive squaring.
But these problems seem to be more dificult as they involve operations insted of a single number.
How could I solve them ?


*

*$(4^{103} + 2(5^{104}))^{102}$ by $13$

*$53^{103}+103^{53}$ by $39$ 

 A: $$ 
(4^{103}+2 \cdot 5^{104})^{102}\overset{13}{\equiv} 
(4^{3 \cdot 34+1}+2 \cdot 5^{2 \cdot 52})^{102}\overset{13}{\equiv} 
(4^{3 \cdot 34}4^1+2 \cdot 5^{2 \cdot 52})^{102}\overset{13}{\equiv} 
\\ 
\left((4^{3})^{34} \cdot 4^1+2 \cdot (5^{2})^{52}\right)^{102}\overset{13}{\equiv} 
\left(64^{34} \cdot 4^1+2 \cdot 25^{52}\right)^{102}\overset{13}{\equiv} 
\\ 
\left((-1)^{34}4^1+2(-1)^{52}\right)^{102}\overset{13}{\equiv} 
6^{102}\overset{13}{\equiv} 
6^{6}\overset{13}{\equiv} 
36^{3}\overset{13}{\equiv} 
10^{3}\overset{13}{\equiv} 
100.10\overset{13}{\equiv} 
9.10\overset{13}{\equiv} 
-1 
$$  


$$ 
53^{103}+103^{53}\overset{13}{\equiv} 
1^{103}+(-1)^{53}\overset{13}{\equiv} 
1-1\overset{13}{\equiv} 0;
$$
$$ 
53^{103}+103^{53}\overset{3}{\equiv} 
(-1)^{103}+1^{53}\overset{3}{\equiv} 
-1+1\overset{3}{\equiv} 0;
$$
which implies that $53^{103}+103^{53}\overset{39}{\equiv} 0$ .
A: Variants :
First congruence :
Observe first that $2$ has order $12 \bmod13$, so $4$ has order $6$, and that as $5^2\equiv -1\mod 13$, $5$ has order $4$. Thus 
$$4^{103}+2\cdot 5^{104}\equiv 4^{103\bmod 6}2\cdot 5^{104\bmod 4}=4^1+2\cdot 5^0=6.$$
Now $6=2\cdot 3$ and we know $2$ has order $12 \bmod 13$, whereas $3$ has order $3$. We conclude that
$$6^{102}\equiv 2^{102\bmod 12}\cdot3^{102\bmod 3}=2^6\cdot3^0\equiv -1\mod 13.$$
Second congruence :
Using the Chinese remainder theorem, it is enough to calculate the expression modulo $3$ and modulo $13$.


*

*Modulo $3$: $\;53\equiv 2$, which has order $2\bmod 3$, and $103\equiv 1$, so
$$53^{103}+103^{53}\equiv 2^{103\bmod 2}+1^{53}\equiv 0\mod 3.$$

*Modulo $13$: $\;53\equiv 1$ and $103\equiv -1$, so $$53^{103}+103^{53}\equiv 1+(-1)^{53}\equiv 0\mod 13.$$
The Chinese remainder theorem asserts the canonical map
$$\mathbf Z/39\mathbf Z\longrightarrow\mathbf Z/3\mathbf Z\times\mathbf Z/13\mathbf Z $$
is an isomorphism, so we conclude that $\;53^{103}+103^{53}\equiv 0\mod 39$.
