Problem 4.
Let $x_1,x_2,\dots,x_{2023}$ be pairwise different positive real numbers such that
\[a_n=\sqrt{(x_1+x_2+\dots+x_n)\left(\frac{1}{x_1}+\frac{1}{x_2}+\dots+\frac{1}{x_n}\right)}\]
is an integer for every $n=1,2,\dots,2023.$ Prove that $a_{2023} \geqslant 3034.$

proposed by Merlijn Staps, Netherlands