17. Among the positive integers less than $10^{4}$, how many positive integers $n$ are there such that $2^{n}-n^{2}$ is divisible by 7?
17. Let $a_{n}=b_{n}-c_{n}$, where $b_{n}=2^{n}, c_{n}=n^{2}$, thus $b_{n+3}=8 \cdot 2^{n} \equiv 2^{n}=b_{n}(\bmod 7), c_{n+7}=(n+7)^{2} \equiv$ $n^{2}=c_{n}(\bmod 7)$, so $a_{n+21}=b_{n+21}-c_{n+21} \equiv b_{n}-c_{n}=a_{n}(\bmod 7)$. Also, among $a_{1}, a_{2}, \cdots, a_{21}$, only 6 terms: $a_{2}=0$, $a_{4}=0, a_{5}=7, a_{6}=28, a_{10}=924, a_{15}=32543$ are divisible by 7, and $9999=476 \times 21+3$ and among $a_{1}, a_{2}, a_{3}$ only $a_{2}$ is divisible by 7, so the number of positive integers $n$ less than $10^{4}$ for which $a_{n}=2^{n}-n^{2}$ is divisible by 7 is $476 \times 6+1=2857$.