In a competition, the competitors occupy all the seats in a rectangular hall where the seats are arranged in rows and columns such that there are more than two rows and in each row there are more than two seats. At a given moment, these competitors receive the order to shake hands only with their direct neighbors in the hall, that is, those who are to their left, right, in front, behind, and diagonally.

![](https://cdn.mathpix.com/cropped/2024_05_01_12f29789e10e6749ebb9g-43.jpg?height=290&width=426&top_left_y=804&top_left_x=887)

Someone noticed that 1020 handshakes were given. Let $n$ be the number of rows and $m$ the number of seats in each row.

a) What are the possible numbers of handshakes that each competitor in the hall could have given?

b) For each of the quantities $x$ described in the previous item, calculate how many competitors gave $x$ handshakes.

c) Determine the number of competitors who were in the hall.
Solution

a) A competitor who sat in one of the 4 corners of the hall gave 3 handshakes. If a competitor sat on any of the 4 edges, but not positioned in the corners, he gave 5 handshakes. Finally, if a competitor sat in the interior of the hall, he gave 8 handshakes.

The following figure illustrates these possibilities.

| 3 | 5 | 3 |
| :---: | :---: | :---: |
| 5 | 8 | 5 |
| 3 | 5 | 3 |

b) There are 4 people who shook hands with 3 people, $2(n-2)+2(m-2)$ people who shook hands with 5 people, and $(n-2)(m-2)$ people who shook hands with 8 people.

c) Multiplying the number of people from the previous item by the corresponding handshakes, we will have counted each of them twice, therefore

$$
\begin{aligned}
8 \cdot(n-2)(m-2)+5 \cdot[2(n-2)+2(m-2)]+3 \cdot 4 & =2 \cdot 1020 \\
8 m n-6 n-6 m & =2036
\end{aligned}
$$

Thus, $m=\frac{1018+3 n}{4 n-3}$. For $m$ to be an integer, $4 n-3$ must divide $1018+3 n$ and consequently $4 n-3$ must divide $4(1018+3 n)=3(4 n-3)+4081$. Since $4 n-3$ divides $3(4 n-3)$, it follows that $4 n-3$ divides $4081=7 \cdot 11 \cdot 53$. The divisors of 4081 are 1, 7, 11, 53, 77, 371, 583, and 4081. Note that $4 n-3$ leaves a remainder of 1 when divided by 4 and, from this list of divisors, the only ones that can be equal to $4 n-3$ are: $1,53,77$ and 4081. If

$$
\begin{aligned}
& 4 n-3=1 \Rightarrow n=1 \\
& 4 n-3=53 \Rightarrow n=14 \\
& 4 n-3=77 \Rightarrow n=20 \\
& 4 n-3=4081 \Rightarrow n=1021
\end{aligned}
$$

The first and fourth cases are not admissible, as there are more than two rows and in each row there are more than two seats. Thus $n=14$ and $m=\frac{1018+3 \cdot 14}{4 \cdot 14-3}=20$ or else $n=20$ and $m=\frac{1018+3 \cdot 20}{4 \cdot 20-3}=14$. Therefore, there were $m \cdot n=280$ competitors in the hall.

[^0]:    ${ }^{2}$ In this notation, $b$ is the units digit and $a$ is the tens digit.