<s>[INST] How many natural numbers $n$ not greater than $10000$ are there such that $2^n - n^2$ is divisible by $7$? How many natural numbers $n$ not greater than $10000$ are there such that $2^n - n^2$ is divisible by $7$?
Please help me solve this question!
 [/INST] Hint. Since $2^3\equiv 1 \pmod {7}$, consider $n=3q+r$ with the remainder $r=0,1,2$. 
If $r=0$, then $1\leq q \leq 3333$ and 
$$0\equiv 2^n - n^2=1-9q^2\equiv 1-2q^2\implies q\equiv 2, q\equiv 5\pmod{7}$$
Therefore the number of $n=6q$ is equal to
$$\left\lfloor\frac{3333-2}{7}\right\rfloor+1+\left\lfloor\frac{3333-5}{7}\right\rfloor+1=952.$$
Now consider the remaining similar cases. At the end you should find that for $r=1,2$ the number of $n$s are respectively $953$, $953$. 
Therefore the answer should be $952+953+953=2858$.
</s>