# Problem 6. (14 points)

A finite sequence of numbers $x_{1}, x_{2}, \ldots, x_{N}$ has the following property:

$$
x_{n+2}=x_{n}-\frac{1}{x_{n+1}} \text { for all } 1 \leq n \leq N-2 \text {. }
$$

Find the maximum possible number of terms in this sequence if $x_{1}=20 ; x_{2}=16$.
# Solution

The sequence will have the maximum number of terms if its last term is equal to zero. Otherwise, this sequence can be continued.

For all $1 \leq n \leq N-2$ we have

$$
x_{n+2}=x_{n}-\frac{1}{x_{n+1}} \Leftrightarrow x_{n+2} \cdot x_{n+1}=x_{n+1} \cdot x_{n}-1 \Leftrightarrow x_{n+1} \cdot x_{n}=x_{n+2} \cdot x_{n+1}+1
$$

Let $x_{N}=0$, then

$$
\begin{gathered}
x_{N-1} \cdot x_{N-2}=x_{N} \cdot x_{N-1}+1=1 \\
x_{N-2} \cdot x_{N-3}=x_{N-1} \cdot x_{N-2}+1=1+1=2 \\
\ldots \ldots \ldots \ldots \ldots \ldots \ldots \ldots \ldots \ldots \ldots \ldots \\
x_{3} \cdot x_{2}=(N-4)+1=N-3 \\
x_{2} \cdot x_{1}=(N-3)+1=N-2=20 \cdot 16 \Rightarrow N=20 \cdot 16+2=322
\end{gathered}
$$

Answer: 322.