TITLE: $a_n$ is the smallest positive integer number such that $\sqrt{a_n+\sqrt{a_{n-1}+...+\sqrt{a_1}}}$ is positive integer
QUESTION [34 upvotes]: An infinite sequence of pairwise distinct numbers $a_1, a_2, a_3, ...$ is defined thus: $a_n$ is the smallest positive integer number such that $\sqrt{a_n+\sqrt{a_{n-1}+...+\sqrt{a_1}}}$ is positive integer.
Prove that the sequence $ a_1, a_2, a_3, ... $ contains all positive integers numbers.
My work:
Let $a_1=1$. Then $\sqrt{a_2+1}$ is positive integer and $a_2$ is the smallest positive integer then $a_2=3$.
Then $\sqrt{a_3+2}$ is positive integer and $a_3$ is the smallest positive integer then $a_3=2$.
Then $\sqrt{a_4+\sqrt{a_3+\sqrt{a_{2}+\sqrt{a_1}}}}=\sqrt{a_4+2}$ is positive integer and $a_4$ is the smallest positive integer and $a_4\not=a_1,a_2,a_3$ then $a_4=7$.

REPLY [4 votes]: It seems to me, from looking at the graphs in Ivan Neretin's answer, that one change of phase is indicated by $a_i=a_{i-1}-1$. The change of phase the other way could be defined by the highest $a_i$ preceding a phase-change of the first kind. I realise that there are alternative definitions of when exactly the phase changes. But with the above definitions, the changes of the first kind are at $i=3, 5, 19, 112, 630, 3637, 21101, 122766, 714992, 4165987, 24278023,\dots$, with  $a_i=2, 6, 30, 182, 1056, 6162, 35910, 209306, 1219920, 7110222, 41441406,\dots$. In each case, the preceding high points were at $i=2, 4, 10, 48, 269, 1521, 8780, 50942, 296383, 1726143, 10057582,\dots$ with $a_i=3, 7, 33, 190, 1075, 6208, 36021, 209574, 1220567, 7111784, 41445177,\dots$. With each of these four sequences, the ratio of term to preceding term seems to converge to the value $3+2\sqrt2\sim5.82842712474619$ which is the limit of the term-ratio of the recurrence $b_n=6b_{n-1}-b_{n-2}$. (The term-ratios of the above sequence $a_i=2, 6,\dots$ converge somewhat more quickly than those of the other sequences above.)