5. In a class, there are $n$ boys and $n$ girls $(n \geqslant 3)$. They sat around a round table such that no two boys and no two girls sit next to each other. The teacher has $2 n$ cards, on which the numbers $1,2,3, \ldots, 2 n$ are written, each one appearing once. He distributed one card to each student such that the number on any girl's card is greater than the number on any boy's card. Then, each boy wrote down the sum of the numbers on three cards: his own and those of the girls sitting next to him. For which $n$ could all the $n$ numbers obtained be equal?
Answer: for odd $n$

Solution. According to the problem, the boys received cards with numbers from 1 to $n$, and the girls received cards with numbers from $n+1$ to $2 n$. Suppose that all the boys ended up with the number $m$ on their slips of paper. Then the sum of all the numbers on the slips is $m n$, which can also be obtained as follows: add all the numbers that the boys have and add twice the sum of all the numbers that the girls have.

Therefore,

$$
m n=\sum_{j=1}^{n} j+2 \sum_{j=n+1}^{2 n} j=2 \sum_{j=1}^{2 n} j-\sum_{j=1}^{n} j=2 n(2 n+1)-\frac{1}{2} n(n+1)=2 n(2 n+1)-n \cdot \frac{n+1}{2}
$$

Thus, $m=4 n+2-\frac{n+1}{2}$ and $n-$ is odd. Let $n=2 k-1$, then $m=7 k-2$. For an example, we need to sequentially distribute the cards to the girls from $2 k$ to $4 k-2$, skipping one each time. If we now look at the sum of the numbers that the girls sitting next to each boy have, we will get all the sums from $5 k-1$ to $7 k-3$ exactly once. Next, we need to supplement these sums with numbers from 1 to $2 k-1$ (by distributing the corresponding cards to the boys) so that all the sums become equal to $7 k-2$. An example of card distribution for $n=9$ and $k=5$ is shown in the figure.

![](https://cdn.mathpix.com/cropped/2024_05_06_e0197926f6acc0f95da5g-09.jpg?height=488&width=489&top_left_y=1252&top_left_x=795)

## GRADES 10-11. THIRD VARIANT