TITLE: Ramanujan's radical and how we define an infinite nested radical
QUESTION [45 upvotes]: I know it is true that we have
$$\sqrt{1+2\sqrt{1+3\sqrt{1+4\sqrt{1+\cdots}}}}=3$$
The argument is to break the nested radical into something  like
$$3 = \sqrt{9}=\sqrt{1+2\sqrt{16}}=\sqrt{1+2\sqrt{1+3\sqrt{25}}}=...=\sqrt{1+2\sqrt{1+3\sqrt{1+4\sqrt{1+\cdots}}}}$$
However, I am not convinced. I can do something like
$$4 = \sqrt{16}=\sqrt{1+2\sqrt{56.25}}=\sqrt{1+2\sqrt{1+3\sqrt{\frac{48841}{144}}}}=...=\sqrt{1+2\sqrt{1+3\sqrt{1+4\sqrt{1+\cdots}}}}$$
Something must be wrong and the reason behind should be a misunderstanding of how we define infinite nested radical in the form of 
$$ \sqrt{a_{0}+a_{1}\sqrt{a_{2}+a_{3}\sqrt{a_{4}+a_{5}\sqrt{a_{6}+\cdots}}}} $$
I researched for a while but all I could find was computation tricks but not a strict definition. Really need help here. Thanks.

REPLY [22 votes]: The user @Eevee Trainer provided a nice explanation on how we define infinite nested radical in terms of limit of finite nested radical which should be insensitive of the starting point. For full generality in this regard, we can consider the convergence of the following finite nested radical
$$ \sqrt{1 + 2 \sqrt{1 + 3 \sqrt{ 1 + \cdots n \sqrt{1 + (n+1) a_n}}}} \tag{*} $$
for a given sequence $(a_n)$ of non-negative real numbers. In this answer, I will prove the convergence of $\text{(*)}$ to $3$ under a mild condition. My solution will involve some preliminary knowledge on analysis.

Setting. We consider the map $\Phi$, defined on the space of all functions from $[0,\infty)$ to $[0, \infty)$, which is given by
$$ \Phi [f](x) = \sqrt{1 + xf(x+1)}. $$
Let us check how $\Phi$ is related to our problem. The idea is to apply the trick of computing Ramanujan's infinite nested radical not to a single number, but rather to a function. Here, we choose $F(x) = x+1$. Since
$$ F(x) = 1+x = \sqrt{1+x(x+2)} = \sqrt{1 + xF(x+1)} = \Phi[F](x), $$
it follows that we can iterated $\Phi$ several times to obtain
$$ F(x) = \Phi^{\circ n}[F](x) = \sqrt{1 + x\sqrt{1 + (x+1)\sqrt{1 + \cdots (x+n-1)\sqrt{(x+n+1)^2}}}}, $$
where $\Phi^{\circ n} = \Phi \circ \cdots \circ \Phi$ is the $n$-fold function composition of $\Phi$. Of course, the original radical corresponds to the case $x = 2$. This already proves that $\Phi^{\circ n}[F](x)$ converges to $F(x)$ as $n\to\infty$.
On the other hand, infinite nested radicals do not have any designated value to start with, and so, the above computation is far from satisfactory when it comes to defining infinite nested radical. Thus, a form of robustness of the convergence is required. In this regard, @Eevee Trainer investigated the convergence of
$$\Phi^{\circ n}[1](2) = \sqrt{1 + 2\sqrt{1 + 3\sqrt{1 + \cdots (n+1)\sqrt{1}}}}, $$
and confirmed numerically that this still tends to $F(2) = 3$ as $n$ grows. Of course, it will be ideal if we can verify the same conclusion for other choices starting points and using rigorous argument.
Proof. One nice thing about $\Phi$ is that it enjoys monotone, i.e., if $f \leq g$, then $\Phi [f] \leq \Phi [g]$. From this, it is easy to establish the following observation.

Lemma 1. For any $f \geq 0$, we have $\liminf_{n\to\infty} \Phi^{\circ n}[f](x) \geq x+1$.

Proof. We inductively apply the monotonicity of $\Phi$ to find that
$$\Phi^{\circ (n+1)} [0](x) \geq x^{1-2^{-n}} \qquad \text{and} \qquad \Phi^{\circ n}[x](x) \geq x + 1 - 2^{-n}. $$
So, for any integer $m \geq 0$,
\begin{align*}
\liminf_{n\to\infty} \Phi^{\circ n}[f](x)
&\geq \liminf_{n\to\infty} \Phi^{\circ m}[\Phi^{\circ (n+1)}[0]](x)
\geq \liminf_{n\to\infty} \Phi^{\circ m}[x^{1-2^{-(n-1)}}](x) \\
&= \Phi^{\circ m}[x](x)
\geq x + 1 - 2^{-m},
\end{align*}
and letting $m \to \infty$ proves Lemma 1 as required.

Lemma 2. If $\limsup_{x\to\infty} \frac{\log \log \max\{e, f(x)\}}{x} < \log 2$, then $\limsup_{n\to\infty} \Phi^{\circ n}[f](x) \leq x+1$.

Proof. By the assumption, there exists $C > 1$ and $\alpha \in [0, 2)$ such that $f(x) \leq C e^{\alpha^x} (x + 1)$. Again, applying monotonicity of $\Phi$, we check that $\Phi^{\circ n}[f](x) \leq C^{2^{-n}} e^{(\alpha/2)^n \alpha^x} (x+1)$ holds. This is certainly true if $n = 0$. Moreover, assuming that this is true for $n$,
\begin{align*}
\Phi^{\circ (n+1)}[f](x)
&\leq \Phi\left[C^{2^{-n}} e^{(\alpha/2)^n \alpha^x} (x+1)\right](x) \\
&= \left( 1 + x C^{2^{-n}} e^{(\alpha/2)^n \alpha^{x+1}} (x+2) \right)^{1/2} \\
&\leq C^{2^{-n-1}} e^{(\alpha/2)^{n+1} \alpha^{x}} (x+1).
\end{align*}
Now letting $n \to \infty$ proves the desired result.

Corollary. If $a_n \geq 0$ satisfies $\limsup_{n\to\infty} \frac{\log\log \max\{e, a_n\}}{n} < \log 2$, then for any $x \geq 0$,
$$ \lim_{n\to\infty} \sqrt{1 + x \sqrt{1 + (x+1) \sqrt{ 1 + \cdots + (x+n-2) \sqrt{1 + (x+n-1) a_n }}}} = x+1. $$

Proof. Apply Lemma 1 and 2 to the function $f$ which interpolates $(a_n)$, such as using piecewise linear interpolation.

The bound in Lemma 2 and Corollary is optimal. Indeed, consider the non-example in OP's question of expanding $4$ as in Ramanujan's infinite nested radical. So we define the sequence $a_n$ so as to satisfy
$$ \sqrt{1 + 2 \sqrt{1 + 3 \sqrt{ 1 + \cdots n \sqrt{1 + (n+1) a_n}}}} = 4. $$
Its first 4 terms are given as follows.
$$ a_1 = \frac{15}{2}, \quad 
a_2 = \frac{221}{12}, \quad
a_3 = \frac{48697}{576}, \quad
a_4 = \frac{2371066033}{1658880}, \quad \cdots. $$
Then we can show that $\frac{1}{n}\log \log a_n \to \log 2$ as $n \to \infty$.