Exercise 6. Let $\left(a_{n}\right)_{n \geqslant 1}$ be the sequence of real numbers defined by $a_{1}=9$ and for all integers $n \geqslant 1$,

$$
a_{n+1}=\frac{(n+5) a_{n}+22}{n+3}
$$

Determine all integers $n \geqslant 1$ such that $a_{n}$ is the square of an integer.
Solution to Exercise 6 We start by manipulating the given recurrence relation. We have $(n+3) a_{n+1}=(n+5) a_{n}+22$ so $(n+3)\left(a_{n+1}+11\right)=(n+5)\left(a_{n}+11\right)$.

In particular,

$$
a_{n}+11=\left(a_{n-1}+11\right) \frac{n+4}{n+2}=\left(a_{n-2}+11\right) \frac{(n+4)(n+3)}{(n+2)(n+1)}=\cdots=\left(a_{1}+11\right) \frac{(n+4) \times \cdots \times 6}{(n+2) \times \cdots \times 4}
$$

We recognize a telescoping product and deduce that $a_{n}+11=20 \times \frac{(n+4)(n+3)}{20}=n^{2}+7 n+12$.

Thus we have $a_{n}=n^{2}+7 n+1$. Let's try to compare $a_{n}$ to well-chosen perfect squares. For example, if $n \geqslant 1, (n+4)^{2}=n^{2}+8 n+16>a_{n}>n^{2}+2 n+1=(n+1)^{2}$. In particular, if $a_{n}$ is a square, $a_{n}$ is either $(n+3)^{2}$ or $(n+2)^{2}$. Let's solve the two equations:

- $a_{n}=(n+2)^{2}$ is equivalent to $3 n=3$ so $n=1$. Conversely, for $n=1, a_{1}=9$ is a perfect square.
- $a_{n}=(n+3)^{2}$ is equivalent to $n=9$. For $n=9$, we get $a_{n}=81+63+1=144=12^{2}$ which is indeed a perfect square.

Thus the solutions are $n=1$ and $n=9$.

Graders' Comment: The exercise is often well handled.