Exercise 5. In a classroom, there are ten students. Aline writes ten consecutive integers on the board. Each student chooses one of the ten integers written on the board, such that any two students always choose two different integers. Each student then calculates the sum of the nine integers chosen by the other nine students. Each student whose result is a perfect square then receives a gift.

What is the maximum number of students who will receive a gift?

A perfect square is an integer of the form $n^{2}$, where $n$ is a natural number.
Solution to Exercise 5 The exercise asks to determine the maximum value of a certain quantity. The reasoning therefore consists of two steps, called analysis and synthesis.

Step 1, the analysis: We show that the number of students receiving a gift is necessarily less than or equal to four, regardless of the numbers chosen by Aline.

Let $n, n+1, \ldots, n+9$ be the ten numbers written on the board and let $S$ be their sum. If one of the integers is erased from the board, the sum of the remaining nine numbers is one of the integers:

$$
S-n, S-n-1, \ldots, S-n-9
$$

which are ten consecutive integers.

We then seek the maximum number of integers that can be perfect squares among ten consecutive integers.

First, since perfect squares are positive integers, a set of ten consecutive integers containing a negative integer has fewer perfect squares than the set $\{0, \ldots, 9\}$. Next, note that among the integers from 0 to 9, there are four perfect squares, which are the integers $0,1,4$ and 9. Suppose there exist ten consecutive positive integers such that at least five of them are perfect squares. Then there exists a positive integer $a$ such that the numbers $a^{2},(a+1)^{2},(a+2)^{2},(a+3)^{2}$ and $(a+4)^{2}$ are among the ten consecutive integers. We then have $9 \geqslant(a+4)^{2}-a^{2}=8 a+16>9$, which is absurd.

Thus, the maximum number of integers that can be perfect squares among the ten integers $S-n, \ldots, S-n-9$ is 4, which means that at most four students will receive a gift.

Step 2, the synthesis: We show that the bound obtained in the analysis is achievable, that is, there exist ten consecutive integers for which the students can arrange to receive four gifts.

For this, we observe that the sum of nine of the ten integers $n, n+1, \ldots, n+9$ is always between

$$
n+(n+1)+\ldots+(n+8)=9 n+36 \quad \text { and } \quad(n+1)+(n+2)+\ldots+(n+9)=9 n+45
$$

Thus, the perfect squares chosen by the students are integers between $9 n+36$ and $9 n+45$. We saw during the analysis that the set $\{0, \ldots, 9\}$ contains 4 perfect squares. We therefore seek $n$ satisfying $9 n+36=0$ and $9 n+45=9$, which leads to $n=-4$.

Thus, if Aline writes the integers

$$
-4,-3,-2,-1,0,1,2,3,4,5
$$

the students can choose the integers $5,4,1$ or -4, so that the sum of the remaining nine integers will be respectively $0,1,4$ and 9.

The largest number of students who can receive a gift is four.

Comment from the graders: The exercise was difficult for many students and was often only partially solved. It consisted of two parts: an analysis to show that it is not possible to do better than 4 gifts, and a synthesis in which it is necessary to explicitly state with which initial integers on the board it is actually possible to obtain 4 gifts. Many students did not take into account the fact that the integers written on the board were relative, i.e., positive or negative, and limited themselves to the positive case. Many students overlooked key arguments, such as the fact that the sums obtained are consecutive, which justifies looking for squares in an interval of size 10. Some attempt to invoke arguments of "density" of squares to try to justify that one must look at small integers to find many squares, but this argument is insufficient. Finally, a surprising proportion of students forget that 0 is a perfect square, which was ultimately not penalized.