Let $n \geqslant 1$ be an integer. A sequence of reals is called pretty if $a_{0}+a_{1}=-\frac{1}{n}$ and, for $k \geqslant 1, \left(a_{k-1}+a_{k}\right)\left(a_{k}+a_{k+1}\right)=a_{k-1}+a_{k+1}$. Determine the largest integer $N$ such that there exists a pretty sequence $a_{0}, \ldots, a_{N}$.
Let $b_{k}=a_{k-1}+a_{k}$. Then we have $b_{1}=-\frac{1}{n}$ and $b_{k} b_{k+1}=b_{k}-b_{k+1}$, which implies $b_{k+1}\left(b_{k}+1\right)=b_{k}$. Thus, if $b_{k} \neq-1$, we have $b_{k+1}=\frac{b_{k}}{b_{k}+1}$, and by immediate induction $b_{k}=-\frac{1}{n+1-k}$ for $1 \leqslant k \leqslant n$. In particular, $b_{n}=-1$, and thus if $N>n$ we should have $b_{n+1}\left(b_{n}+1\right)=b_{n}$, which is $0=-1$, a contradiction. Therefore, $N \leqslant n$.

Conversely, with $N=n$, if we set $a_{0}=0$ and $a_{k}=-\frac{1}{n+1-k}-a_{k-1}$, the resulting sequence is clearly a solution.