<s>[INST] 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.
 [/INST] $2^{\large 7!}\!\pmod{\color{brown}{29}87}\,$ can be computed using only simple mental arithmetic.
Note that  $\ \color{brown}{29}\!\mid\! 87,\,$ i.e. $\, 29\cdot 3 = 87\ $ so $\ 2987 = 29(100\!+\!3) = 29\cdot 103$
Since $\, p = 29,103\,$ are prime, we can use little Fermat to reduce exponents, i.e.
$(1)\qquad\qquad\ \ N \equiv n\pmod{p\!-\!1}\ \Rightarrow\ 2^{N}\!\equiv 2^{n}\pmod p$
${\rm mod}\,\ \ 28\!:\ 7! \equiv 0\ $ by $\ 7,4\mid 7!\,\Rightarrow\, 28=7\cdot 4\mid 7!$ 
${\rm mod}\ 102\!:\, 7! \equiv (7\cdot 5\cdot 3)(6\cdot 4\cdot 2)\equiv 105(14\!+\!34)\equiv 3(14) \equiv 42,\, $ so,  $ $ applying $(1)$
${\rm mod}\ 29\!:\ \ \ x\equiv  2^{\large 7!}\equiv 2^{0}\equiv\color{#c00} 1$
${\rm mod}\ 103\!:\ x\equiv 2^{\large 7!}\equiv 2^{42}.\ $  Let's compute this power: 
$\qquad\ 2^{10}=1024\equiv 1030\!-\!6\equiv -6,\,$ so $\,2^{11}\equiv -12\,$ so $\,2^{21}\equiv (-6)(-12) \equiv 72\equiv -31$  
$\ \Rightarrow\  2^{42} \equiv (2^{21})^2\equiv (-31)^2\equiv (1\!+\!30)^2 \equiv 1 + 2(30)+9(-3)\equiv \color{blue}{34}$
Finally we apply $ $ CRT = Chinese Remainder Theorem:
${\rm mod}\ 29\!:\ \color{#c00}1\equiv x\equiv \color{blue}{34}\!+\!103j\equiv 5\!+\!16j\!\iff\! 16j\equiv -4\!\iff\! 4j\equiv -1\equiv 28\!\iff\! j\equiv\color{#0a0} 7$
So we deduce $\ x = 34\! +\! 103(\color{#0a0}7\!+\!29k)\, =\, 755 + 2987k$
</s>