2. We consider the sequence of numbers $0,1,2,4,6,9,12, \ldots$ which we generate by starting with 0, then adding 1, and adding 1 again, then adding 2 and adding 2 again, then adding 3 and adding 3 again, and so on. If we denote the terms of this sequence by $a_{0}, a_{1}, a_{2}, a_{3}, a_{4}, \ldots$, then $a_{0}=0$ and

$$
a_{2 n-1}=a_{2 n-2}+n, \quad a_{2 n}=a_{2 n-1}+n
$$

for all integers $n \geqslant 1$.

Find all integers $k \geqslant 0$ for which $a_{k}$ is the square of an integer.
2. For $n \geqslant 1$ we find that $a_{2 n}=a_{2 n-1}+n=a_{2 n-2}+2 n$, so $a_{2 n}=0+2+4+\cdots+2 n=$ $2(0+1+2+\cdots+n)=n(n+1)$. Now it holds (since $n>0$) that $n^{2}<n^{2}+n<n^{2}+2 n+1=(n+1)^{2}$, so $a_{2 n}=n(n+1)$ can never be a square; it lies precisely between two consecutive squares. The even $k \geqslant 2$ therefore do not satisfy the condition. From $a_{2 n-1}=a_{2 n}-n=n(n+1)-n=n^{2}$ it follows that $a_{2 n-1}$ is always a square, so all odd $k$ do satisfy the condition. Finally, $a_{0}=0$ is also a square. We conclude that all odd $k$ and $k=0$ satisfy the condition, and all other $k$ do not.