31.11. a) Find the remainder of the division of $171^{2147}$ by 52.

b) Find the remainder of the division of $126^{1020}$ by 138.
31.11. a) Answer: 7. The numbers 171 and 52 are coprime, so $171^{\varphi(52)} \equiv 1(\bmod 52)$. Further, $\varphi(52)=\varphi(4) \varphi(13)=24$. Therefore, $171^{2147} \equiv 15^{24 \cdot 89+11} \equiv 15^{11} \equiv 7(\bmod 52)$.

b) Answer: 54. The numbers 126 and 138 are not coprime: their GCD is 6. We will use the fact that if $a \equiv b(\bmod 23)$, then $6 a \equiv 6 b(\bmod 138)$. Let $a=21 \cdot 126^{1019}$. Then $a \equiv 21 \cdot 11^{22 \cdot 46+7} \equiv$ $\equiv-2 \cdot 11^{7} \equiv 9(\bmod 23)$. Therefore, $126^{1020}=6 a \equiv 54(\bmod 138)$.