1. Let $[x]$ denote the greatest integer not exceeding the real number $x$. Given a sequence of positive integers $\left\{a_{n}\right\}$ satisfying $a_{1}=a$, and for any positive integer $n$,
$$
a_{n+1}=a_{n}+2\left[\sqrt{a_{n}}\right] \text {. }
$$
(1) If $a=8$, find the smallest positive integer $n$ such that $a_{n}$ is a perfect square;
(2) If $a=2017$, find the smallest positive integer $n$ such that $a_{n}$ is a perfect square.
(Chen Xiangrui, problem contributor)
1. (1) Given $a_{1}=8$, we sequentially calculate
$$
a_{2}=12, a_{3}=18, a_{4}=26, a_{5}=36 \text {. }
$$

Thus, the smallest $n$ for which $a_{n}$ is a perfect square is 5.
(2) First, we prove a lemma.

Lemma For any term $a_{n}$ in the sequence, if there exists a positive integer $k$ such that $k^{2}<a_{n}<(k+1)^{2}$, then
$$
(k+1)^{2} \leqslant a_{n+1}<(k+2)^{2},
$$

and $\square$
$$
a_{n+1}-(k+1)^{2}=\left(a_{n}-k^{2}\right)-1 \text {. }
$$

Proof
$$
\begin{array}{l}
k^{2}<a_{n}<(k+1)^{2} \\
\Rightarrow\left[\sqrt{a_{n}}\right]=k \\
\Rightarrow a_{n+1}=a_{n}+2 k \\
\Rightarrow k^{2}+2 k<a_{n+1}<(k+1)^{2}+2 k \\
\Rightarrow(k+1)^{2} \leqslant a_{n+1}<(k+2)^{2} .
\end{array}
$$

Also, note that,
$$
\begin{array}{l}
a_{n+1}-(k+1)^{2} \\
=a_{n}+2 k-(k+1)^{2} \\
=\left(a_{n}-k^{2}\right)-1 .
\end{array}
$$

The lemma is proved.
Given $a_{1}=2017=44^{2}+81$, by the lemma we have
$$
a_{2}=45^{2}+80 \text {. }
$$

More generally, when $1 \leqslant i \leqslant 82$,
$$
a_{i}=(43+i)^{2}+82-i \text {. }
$$

Thus, the smallest $n$ for which $a_{n}$ is a perfect square is 82.