# How to evaluate the limit of a function consists of Range

I would like to evaluate the limit: $$\sqrt{1+\sqrt{2+\sqrt{3+\sqrt{4+\sqrt{5+\cdots}}}}}$$ Therefore, I write the following function of n:

g[p_, n_] := Sqrt[p] + n;
f[n_] := Sqrt[Fold[g, 0, Reverse@Range@n]],

and evaluate the limit:

Limit[f[n], n -> Infinity].

But Mathematica said:

Range::range: "Range specification in Range[n] does not have appropriate bounds."

Is there something wrong with my code? How can i make this work? Thanks in advance.

• (1) Limit operates on continuous parameters only. It sometimes "works" for functions of a discrete parameter (sequences) but only if they accidently have definitions in terms of a continuous parameter that give the same limiting behavior. – Daniel Lichtblau Nov 27 '15 at 16:17
• (2) Limit has absolutely no capability to handle what amounts to a program, e.g. f[n_]:=... where the ... part is computed by an iterative algorithm (e.g. using a function such as Fold or Nest). – Daniel Lichtblau Nov 27 '15 at 16:19
• (3) I would surmise this is a difficult problem to do using Mathematica other than in an approximation approach. So it is an interesting question. – Daniel Lichtblau Nov 27 '15 at 16:28
• @DanielLichtblau Thanks，I finally know why it is difficult to calculate this limit of the sequence in Mathematica. – robit Nov 29 '15 at 9:00