Example 4 (2004 Singapore Mathematical Olympiad) Find the number of ordered integer pairs $(a, b)$ such that $x^{2}+$ $a x+b=167 y$ has integer solutions $(x, y)$, where $1 \leqslant a, b \leqslant 2004$.
First, prove a lemma.
Lemma: If $p$ is an odd prime, when $x$ runs through a complete residue system modulo $p$, $x^{2}$ modulo $p$ can take exactly $\frac{p+1}{2}$ values from $0, 1, \cdots, p-1$.
Proof of the lemma: When $x \equiv 0(\bmod p)$, $x^{2} \equiv 0(\bmod p)$.
When $p \times x$,
if $x_{1}^{2} \equiv x_{2}^{2}(\bmod p), x_{1} \neq x_{2}(\bmod p)$, then
$$
p\left|\left(x_{1}+x_{2}\right)\left(x_{1}-x_{2}\right), p\right|\left(x_{1}+x_{2}\right).
$$

Thus, $x_{1} \equiv -x_{2}(\bmod p)$.
This way, $1, 2, \cdots, p-1$ can be divided into $\frac{p-1}{2}$ groups
$$
(1, p-1), (2, p-2), \cdots, \left(\frac{p-1}{2}, \frac{p+1}{2}\right).
$$

The squares of numbers in the same group are congruent modulo $p$, and the squares of numbers in different groups are not congruent modulo $p$.
Therefore, the quadratic residues can take exactly $1+\frac{p-1}{2}=\frac{p+1}{2}$ values.
Next, solve the original problem.
When there exists $x \in \mathbf{Z}$ such that $x^{2} + a x + b \equiv 0(\bmod 167)$, then there is an integer solution $(x, y)$, i.e.,
$4 x^{2} + 4 a x + 4 b \equiv 0(\bmod 167)$,
$a^{2} - 4 b \equiv (2 x + a)^{2}(\bmod 167)$.
Therefore, for a given value of $a$, $a^{2} - 4 b$ is a quadratic residue modulo 167.
By the lemma, $a^{2} - 4 b$ modulo 167 can take 84 different values, so $b$ modulo 167 can take 84 different values.
Since $\frac{2004}{167} = 12$, each $a$ corresponds to $84 \times 12$ values of $b$ that satisfy the requirement, thus, there are
$$
2004 \times 84 \times 12 = 2020032
$$

ordered integer pairs.
The sequence $a_{0}, a_{1}, a_{2}, \cdots$ is defined as follows:
For all $k (k \geqslant 0)$,
$$
a_{0} = 2, a_{k+1} = 2 a_{k}^{2} - 1
$$