In an attempt to associate a unique sequence of nested radicals with a generic real number $r>\frac{1+\sqrt{5}}{2}$ $$r=\sqrt{a_0+\sqrt{a_1+\sqrt{a_2+...}}},$$ being $a_n$ positive integers, I have implemented the following algorithm:
- look for the smallest solution $x_{-}$ of the equation $x^2-(2r^2+1)x+r^4=0$;
- take the largest integer $m$ smaller than $x_{-}$ such that $m<r(r-1)$;
- set $a_0=m$;
- update $r$ to the value $r^2-m$;
- return to step 1 to calculate $a_1$ and so on.
I think this procedure assures the increasing monotony of the coefficients $a_n$.
Step 2 is necessary: in fact, in the "worst case", we have to obtain at least $a_k=a_n$ for each $k\gt n$.
For example, $$1.75793...=\sqrt{1+\sqrt{2+\sqrt{3+\sqrt{4+\sqrt{5+\sqrt{6+...}}}}}}$$ $$\pi=\sqrt{6+\sqrt{11+\sqrt{11+\sqrt{18+\sqrt{19+\sqrt{25+...}}}}}}$$
Testing the code with $r=2$, I have obtained
$$2=\sqrt{1+\sqrt{5+\sqrt{11+\sqrt{19+\sqrt{29+\sqrt{41+...}}}}}}$$
So, defined $P(n)=n^2-n-1$, we can write
$$2=\sqrt{P(2)+\sqrt{P(3)+\sqrt{P(4)+...}}}$$
Actually, the previous argument can be generalised in
$$n=\sqrt{P(n)+\sqrt{P(n+1)+\sqrt{P(n+2)+...}}}$$
for each natural $n\ge0$ (squaring both sides you obtain the expression for the natural $n+1$).
Is my previous reasoning correct? How to formalise it in a rigorous way? Is there any relation with continued fractions theory?
Many thanks.
Addendum
Multiplying the last identity by itself, it is not difficult to prove the following further one:
$$n^2=\sqrt{P(n)Q(n)+\sqrt{P(n+1)Q(n+1)+\sqrt{P(n+2)Q(n+2)+...}}}$$
where $Q(n)=n^2+n+1$.
What is quite curious for me is that both relations seem to remain valid even if we replace $n$ with a generic complex number (and, in particular, a positive real one).
For example, $$\sqrt{3}=\sqrt{2-\sqrt{3} +\sqrt{2+\sqrt{3}+\sqrt{4+3\sqrt{3} +\sqrt{8+5\sqrt{3}+...}}}}$$ $$3=\sqrt{5-2\sqrt{3} +\sqrt{21+12\sqrt{3}+\sqrt{85+50\sqrt{3} +\sqrt{233+136\sqrt{3}+...}}}}$$ $$2+i=\sqrt{3i+\sqrt{4+5i+\sqrt{10+7i +\sqrt{18+9i+...}}}}$$