9. Let $[x]$ be the greatest integer not exceeding the real number $x$. Given the sequence $\left\{a_{n}\right\}$ satisfies: $a_{1}=\frac{1}{2}, a_{n+1}=a_{n}^{2}+3 a_{n}+1, \quad n \in N^{*}$, find $\left[\sum_{k=1}^{2017} \frac{a_{k}}{a_{k}+2}\right]$.

9. Analysis: $a_{n+1}=a_{n}^{2}+3 a_{n}+1 \Leftrightarrow a_{n+1}+1=a_{n}^{2}+3 a_{n}+2=\left(a_{n}+1\right)\left(a_{n}+2\right)$, then
$$
\begin{array}{l}
\frac{1}{a_{n+1}+1}=\frac{1}{\left(a_{n}+1\right)\left(a_{n}+2\right)}=\frac{1}{a_{n}+1}-\frac{1}{a_{n}+2} \Rightarrow \frac{1}{a_{n}+2}=\frac{1}{a_{n}+1}-\frac{1}{a_{n+1}+1} \\
\text { Thus }\left[\sum_{k=1}^{2017} \frac{a_{k}}{a_{k}+2}\right]=\left[\sum_{k=1}^{2017}\left(1-\frac{2}{a_{k}+2}\right)\right]=\left[2017-\sum_{k=1}^{2017}\left(\frac{2}{a_{k}+1}-\frac{2}{a_{k+1}+1}\right)\right] \\
=\left[2017-\frac{2}{a_{1}+1}+\frac{2}{a_{2018}+1}\right]=\left[2017-\frac{4}{3}+\frac{2}{a_{2018}+1}\right], \quad \text { clearly } \quad a_{n+1}>3 a_{n}, \quad \text { so } \\
a_{2018}>3^{2017} \cdot \frac{1}{2}, \\
\text { hence the original expression }=\left[2017-\frac{4}{3}+\frac{2}{a_{2018}+1}\right]=2015
\end{array}
$$