I've searched for solutions online and I found them, but there's still one solutions that i can't understand. here there are some solutions to the problem, most of them start by showing that $k \geq 4$ is impossible, one in particular say:
Assume $k \geq 4$. Hence we get the chains $$n=a_1a_k=a_2a_{k-1}=\cdots$$$$m=(a_1+1)(a_k+1)=(a_2+1)(a_{k-1}+1)=\cdots \implies u=a_1+a_k=a_2+a_{k-1}=\cdots$$Hence, the roots of the quadratic $x^2-ux+n=0$ are all the pairs $\{a_1,a_k\},\{a_2,a_{k-1}\}, \cdots$ which is a contradiction as $a_1<a_2<\cdots<a_k$.
I've read all the other solutions, but I still don't understand were this $x^2-ux+n=0$ quadratic formula came from, and why its solutions must be $\{a_1,a_k\},\{a_2,a_{k-1}\}, \cdots$.
Thanks in advance to everyone reading this.