Example 18 Among the positive integers less than 10000, how many integers $x$ can make $2^{x}-x^{2}$ divisible by 7?
First, we prove
$$
2^{21+r}-(21+r)^{2} \equiv 2^{r}-r^{2}(\bmod 7),
$$

where $r \in\{1,2,3, \cdots, 21\}$.
In fact, by $2^{21}=\left(2^{3}\right)^{7}=8^{7} \equiv 1(\bmod 7)$, then
$$
2^{21+r} \equiv 2^{r}(\bmod 7) \text {. }
$$

Also, $(21+r)^{2}=21^{2}+42 r+r^{2} \equiv r^{2}(\bmod 7)$, thus (1) holds.
From (1), we know that $2^{x}-x^{2}$ has a periodic change with a period of 21 when divided by 7.
Let $x=1,2, \cdots, 21$, we can find that there are 6 numbers in $2^{x}-x^{2}$ that can be divided by 7.
That is, when $x=2,4,5,6,10,15$, $2^{x}-x^{2}$ is divisible by 7.
Since $10000=476 \cdot 21+4$,
there are $476 \cdot 6+1=2857$ values of $x$ from 1 to 10000, such that $2^{x}-x^{2}$ is divisible by 7.