$$
a_{n}=\frac{n(n+1)}{2} \Rightarrow S_{m}=\frac{1}{2}\left[\frac{m(m+1)(2 m+1)}{6}+\frac{m(m+1)}{2}\right]=\frac{m(m+1)(m+2)}{6} \text {, }
$$

If and only if $m$ is of the form $8 k+3$, $S_{m}$ is of the form $4 k+2$. Thus, in a cycle of 8 numbers, only 1 number meets the condition. Since $2017=8 \times 252+1$, the number of numbers in $S_{1}, S_{2}, \cdots, S_{2017}$ that are divisible by 2 but not by 4 is 252.
6. Let $a_{n}=1+2+\cdots+n, n \in \mathbf{N}_{+}, S_{m}=a_{1}+a_{2}+\cdots+a_{m}, m=1,2, \cdots, m$, then the number of elements in $S_{1}, S_{2}, \cdots, S_{2017}$ that are divisible by 2 but not by 4 is