What is $2^{7!}\bmod{2987}$ Find the remainder when $2^{7!}$ is divided by $2987$.
I tried to factorise $2987$ to make it simple but it was in vain.

Hint: The unique prime factorization of $2987$ is,
$$2987=29\times 103$$
Now, use Fermat's Little Theorem to reduce the exponent and get the remainder modulo $29$ and $103$.
Combine the results using Chinese Remainder Theorem.

Alternatively, you can use Euler's totient function to compute $\phi(2987)$ and then use Euler's Totient theorem but that might result in tedious calculations and we being lazy never want to do it the tedious way. :P
