Question 200
On the table there are $k$ heaps of $1, 2, \dots, k$ stones, where $k \ge 3$. In the first step, we choose any three of the heaps on the table, merge them into a single new heap, and remove 1 stone (throw it away from the table) from this new heap. In the second step, we again merge some three of the heaps together into a single new heap, and then remove 2 stones from this new heap. In general, in the $i$-th step we choose any three of the heaps, which contain more than $i$ stones when combined, we merge them into a single new heap, and then remove $i$ stones from this new heap. Assume that after a number of steps, there is a single heap left on the table, containing $p$ stones. Show that the number $p$ is a perfect square if and only if the numbers $2k+2$ and $3k+1$ are perfect squares. Further, find the least number $k$ for which $p$ is a perfect square.