<s>[INST] remainder when $a_{1000}$ is divided by $1000$ 
If  $a_{1}=7,a_{2}=7^7,a_{3}=7^{7^{7}}.$ Then the remainder when
$a_{1000}$ is divided by $1000$

what i try
$a_{1}=7=1\mod(1000)$ and
$a_{2}=7^7=1^7\mod(1000)=1\mod(1000)$
from using modulo theorem
$a_{3}=7^{7^{7}}=1^7\mod(1000)=1\mod(7)$
can we say that $a_{1000}= 1\mod(1000)$
Help me to solve it please
 [/INST] $a_1=7\equiv\color{red}7\bmod 1000$.
$a_2=7^7=823543\equiv543\bmod 1000$.
$7^4=2401\equiv401\bmod1000,$ so $7^{20}=(7^4)^5\equiv401^5=(400+1)^5\equiv1\bmod1000$.
Since $a_2\equiv543\bmod1000,$ $a_2\equiv3\bmod20$.  Therefore, $a_3=7^{a_2}\equiv7^3=343\bmod1000$.
Can you take it from here?
</s>