Question about Fermat's Theorem I'm trying to find $2^{25} \mod 21 $. By Fermat's theorem, $2^{20} \cong_{21} 1 $. Therefore, $2^{25} = 2^{20}2^{5} \cong_{21} 2^5 = 32 \cong_{21} 11 $. However, the answer in my book is $2$! What am I doing wrong?
Also, I would like to ask what are the last two digits of $1 + 7^{162} + 5^{121} \times 3^{312} $
Thanks for your help.

By Euler's Theorem, we have $2^{12}\equiv 1\pmod{21}$. That is because $\varphi(21)=(2)(6)=12$. Thus $2^{25}=2^{12\cdot 2}\cdot 2^1\equiv 2\pmod{21}$.
If we want to use Fermat's Theorem, we work separately modulo $3$ and modulo $7$.
We have $2^2\equiv 1\pmod{3}$, and therefore $2^{25}=2^{2\cdot 12}\cdot 2^1\equiv 2\pmod{3}$.
Similarly, $2^6\equiv 1\pmod{7}$ and therefore $2^{25}\equiv 2\pmod{7}$.
It follows that $2^{25}\equiv 2\pmod{21}$.

Added: For the last two digits of $1+7^{162}+(5^{121})(3^{312})$, it will be enough to evaluate modulo $4$ and modulo $25$.
Modulo $4$: We have $7\equiv -1\pmod{4}$, so $7^{162}\equiv 1\pmod{4}$. Similarly, $5^{121}\equiv 1\pmod{4}$ and $3^{312}\equiv 1\pmod{4}$. Adding up, we get the sum is $\equiv 3\pmod{4}$.
Modulo $25$:  We don't have to worry about the messy last term. Note that $7^2\equiv -1\pmod{25}$, so $7^{160}\equiv 1\pmod{25}$. Thus $7^{162}\equiv -1\pmod{25}$. Thus our sum is congruent to $0$ modulo $25$.
Finally, we want the multiple of $25$ between $0$ and $75$ which is congruent to $3$ modulo $4$. A quick scan shows the answer is $75$. 
