Exercise 6. A certain number of students take a mathematics test. If the tables are arranged to form a square, there will be 5 students who will not have a place. On the other hand, if a rectangle is formed with 7 more rows than columns, all students will have a place (and there will be no empty seats). What is the largest possible number of students? Justify your answer.
Solution to exercise 6 Let $n$ be the number of students, $a$ the number of columns in the square, and $b$ the number of columns in the rectangle. Then $n=a^{2}+5=b(b+7)$. We deduce that $(2 a)^{2}+20=$ $(2 b)^{2}+2 \times 7 \times(2 b)=(2 b+7)^{2}-49$, which gives $(2 b+2 a+7)(2 b-2 a+7)=69$.

Let $u=2 b+2 a+7$ and $v=2 b-2 a+7$. We observe that $u$ and $v$ are divisors of 69 such that $uv=69$ and $u>v$, so ( $u=23$ and $v=3$ ) or ( $u=69$ and $v=1$ ).

In the first case, we have $4 a=u-v=20$ so $a=5$, and $2 b=u-2 b-7=6$ so $b=3$ and $n=30$.

In the second case, we have $4 b=u-v=68$ so $a=17$ and $2 b=u-2 a-7=28$ so $b=14$ and $n=294$.

Conclusion: the largest possible number of students is 294.