<s>[INST] Assuming the expression converges, determine the largest integer $n\le 9,000,000$ for which $\sqrt {n+\sqrt {n+\sqrt {n+\cdots}}}$ is rational. What I have done is that I supposed $y=\sqrt {n+\sqrt {n+\sqrt {n+\cdots}}}$.
So, $y^2-n=y$, which is $y^2-y+\frac{1}{4}=n+\frac{1}{4}$. So, $(y-\frac{1}{2})^2=n+{1\over 4}=\frac{4n+1}{4}$.
Hence, $y={1\over 2}\pm\frac{\sqrt {4n+1}}{2}$ is a rational, which means $4n+1$ must be a perfect square.
Then I let $m^2=4n+1$. So, $(m-1)(m+1)=4n$, and that is where I got stuck.
Obviously $m$ must be an odd integer and $n$ CANNOT be a perfect square. But I have no idea what to do next because $n$ can be very big... Could anyone share some ideas?
 [/INST] Let $m=2k+1$. Varying $k$ gives all possible values of $n$ for $y$ to be rational:
$$m^2=4k^2+4k+1=4(k^2+k)+1\implies n=k^2+k=k(k+1)\le9\cdot10^6$$
It is easily seen that the solution corresponds to $k=2999$, i.e. $n=8997000$.
</s>