Question 167
Define the sequence $a_{1}, a_{2}, \ldots$ as follows: $a_{1}=1$, and for every $n \geq 2$, $a_{n}=n-2$ if $a_{n-1}=0$ and $a_{n}=a_{n-1}-1$, otherwise. Find the number of $1 \leq k \leq 2016$ such that there are non-negative integers $r, s$ and a positive integer $n$ satisfying $k=r+s$ and $a_{n+r}=a_{n}+s$.