<s>[INST] Find $7^{100} \pmod{167}$ using Fermat's Little Theorem I understand how to use Fermat's Little theorem but only on exponents that are larger than the mod, therefore, I do not know how to do this question please help, thank you!
 [/INST] I'm not sure how you can use Fermat's little theorem. The standard method for computing powers is to write $100$ in base $2$: $100=\mathtt{1100100}_2$. Next (all congruences modulo $167$)
\begin{align}
7^2&\equiv 49 \\
7^4&\equiv 49^2\equiv 63 \\
7^8&\equiv 63^2\equiv 128 \\
7^{16}&\equiv 128^2\equiv 18 \\
7^{32}&\equiv 18^2\equiv 157 \\
7^{64}&\equiv 157^2\equiv 100
\end{align}
and so
$$
7^{100}\equiv 7^{64}\cdot 7^{32}\cdot 7^4
\equiv 100\cdot 157\cdot 63\equiv 126
$$
One could note that $7^{100}\cdot 7^{66}\equiv 1$, and
\begin{align}
167&=7\cdot23+6\\
7&=6\cdot 1+1
\end{align}
so $1=7-(167-7\cdot 23)=7\cdot24-167$. Thus
$$
7^{100}=24^{66}
$$
But one still has to compute $24^{64}$.
</s>