8. Let $[x]$ denote the greatest integer not exceeding the real number $x$. Set $a_{n}=\sum_{k=1}^{n}\left[\frac{n}{k}\right]$. Then the number of even numbers in $a_{1}, a_{2}, \cdots, a_{2018}$ is . $\qquad$
8. 1028.

It is easy to see that if and only if $k \mid n$,
$$
\left[\frac{n}{k}\right]-\left[\frac{n-1}{k}\right]=1 \text{. }
$$

Otherwise, $\left[\frac{n}{k}\right]-\left[\frac{n-1}{k}\right]=0$.
Thus, $a_{n}-a_{n-1}$
$$
\begin{array}{l}
=\sum_{k=1}^{n}\left[\frac{n}{k}\right]-\sum_{k=1}^{n-1}\left[\frac{n-1}{k}\right] \\
=\sum_{k=1}^{n}\left[\frac{n}{k}\right]-\sum_{k=1}^{n}\left[\frac{n-1}{k}\right] \\
=\sum_{k=1}^{n}\left(\left[\frac{n}{k}\right]-\left[\frac{n-1}{k}\right]\right)
\end{array}
$$

is exactly the number of positive divisors of $n$.
Note that the number of positive divisors of a positive integer $n$ is odd if and only if $n$ is a perfect square. Therefore, $a_{n}$ and $a_{n-1}$ have different parities if and only if $n$ is a perfect square. Since $a_{1}=1$ is odd, $a_{2}$ and $a_{3}$ are both odd, $a_{4}$ is even, $a_{5}$, $a_{6}$, $a_{7}$, and $a_{8}$ are all even, and so on.

Since $2018 \in (44^2, 45^2)$, the number of even numbers among $a_{1}, a_{2}, \cdots, a_{2018}$ is
$$
\sum_{k=2}^{43}(-1)^{k-1} k^{2}+2018-44^{2}+1=1028
$$