
5. Sabine has a very large collection of shells. She decides to give part of her collection to her sister.

On the first day, she lines up all her shells. She takes the shells that are in a position that is a perfect square (the first, fourth, ninth, sixteenth, etc. shell), and gives them to her sister. On the second day, she lines up her remaining shells. Again, she takes the shells that are in a position that is a perfect square, and gives them to her sister. She repeats this process every day.

The 27th day is the first day that she ends up with fewer than 1000 shells. The 28th day she ends up with a number of shells that is a perfect square for the tenth time.

What are the possible numbers of shells that Sabine could have had in the very beginning?



5. Suppose that on a given day, Sabine is left with $n^{2}$ shells, where $n>1$. Then the next day, she will give $n$ shells to her sister and will be left with $n^{2}-n$ shells. This is more than $(n-1)^{2}$, since

$$
(n-1)^{2}=n^{2}-2 n+1=\left(n^{2}-n\right)-(n-1)1$. The next day, she therefore gives $n-1$ shells to her sister and is left with $n^{2}-n-(n-1)=$ $(n-1)^{2}$ shells, again a perfect square. We see that the numbers of shells that Sabine is left with are alternately a perfect square and a number that is not a perfect square.

Let $d$ be the first day that Sabine is left with a number of shells that is a perfect square, say $n^{2}$ shells. Then days $d+2, d+4, \ldots, d+18$ are the second to tenth day that the remaining number of shells is a perfect square (namely $(n-1)^{2},(n-2)^{2}, \ldots,(n-9)^{2}$ shells). We conclude that $d+18=28$, and hence $d=10$.

On day 26 the number of remaining shells is at least 1000 , but on days 27 and 28 this number is less than 1000 . We see that $(n-9)^{2}x-n$ or $x+1-(n+1)=x-n$ shells.

Let $x$ be the number of shells remaining on day 8 . The obvious guess $x=41^{2}=1681$ is incorrect as $x$ cannot be a perfect square. We therefore try $x=41^{2}-2, x=41^{2}-1$, and $x=41^{2}+1$. The table shows the number of shells remaining on day 8,9 , and 10 .

| day 8 | day 9 | day 10 |
| :---: | :---: | :---: |
| $41^{2}-2=1679$ | $1679-40=1639$ | $1639-40=1599$ |
| $41^{2}-1=1680$ | $1680-40=1640$ | $1640-40=1600$ |
| $41^{2}+1=1682$ | $1682-41=1641$ | $1641-40=1601$ |

We see that the case $x=1679$ is ruled out because it would imply that fewer than $40^{2}=1600$ shells are left on day 10. By the above observation, this also rules out the case $x1682$ is ruled out. The number of shells left on day 8 must therefore be $41^{2}-1$.

To follow the pattern back in time, we consider the case that the number of remaining shells is just shy of a perfect square. Suppose that on a given day the number of remaining shells is $n^{2}-a$, where $1 \leqslant an^{2}-n-(n-1)=(n-1)^{2}$. The day after that, the number of remaining shells must therefore be $n^{2}-a-(n-1)-(n-1)=(n-1)^{2}-(a-1)$.

So if Sabine originally had $45^{2}-5$ shells, then the number of remaining shells on days $2,4,6$, and 8 are $44^{2}-4,43^{2}-3,42^{2}-2$, and $41^{2}-1$, respectively. This gives us a solution.

If Sabine originally had $45^{2}-4$ shells, then she would be left with too many shells on day 8 , namely $41^{2}-0$. The original number of shells could therefore not have been $45^{2}-4$ or more.

If Sabine originally had $45^{2}-6$ shells, then she would be left with too few shells on day 8 , namely $41^{2}-2$. The original number of shells could therefore not have been $45^{2}-6$ or fewer.

We conclude that the only possibility is that Sabine started with a collection of $45^{2}-5=2020$ shells.

