I found an interesting infinite sequence recently in the form of a 'two storey continued fraction' with natural number entries:

$$\frac{e^2-3}{e^2+1}=\cfrac{2-\cfrac{3-\cfrac{4-\cdots}{4+\cdots}}{3+\cfrac{4-\cdots}{4+\cdots}}}{2+\cfrac{3-\cfrac{4-\cdots}{4+\cdots}}{3+\cfrac{4-\cdots}{4+\cdots}}}$$

The numerical computation was done 'backwards', starting from some $x_n=1$ we compute:

$$x_{n-1}=\frac{a_n-x_n}{a_n+x_n}$$

And so on, until we get to $x_0$. The sequence converges for $n \to \infty$ if $a_n>1$ (or so it seems).

For constant $a_n$ we seem to have quadratic irrationals, for example:

$$\frac{\sqrt{17}-3}{2}=\cfrac{2-\cfrac{2-\cfrac{2-\cdots}{2+\cdots}}{2+\cfrac{2-\cdots}{2+\cdots}}}{2+\cfrac{2-\cfrac{2-\cdots}{2+\cdots}}{2+\cfrac{2-\cdots}{2+\cdots}}}$$

For $a_n=2^n$ we seems to have:

$$\frac{1}{2}=\cfrac{2-\cfrac{4-\cfrac{8-\cdots}{8+\cdots}}{4+\cfrac{8-\cdots}{8+\cdots}}}{2+\cfrac{4-\cfrac{8-\cdots}{8+\cdots}}{4+\cfrac{8-\cdots}{8+\cdots}}}$$

I found no other closed forms so far, and I don't know how to prove the formulas above. How can we prove them? What is known about such continued fractions?

There is another curious thing. If we try to expand some number in this kind of fraction, we can do it the following way:

$$x_0=x$$

$$a_0=\left[\frac{1}{x_0} \right]$$

$$x_1=\frac{1-a_0x_0}{1+a_0x_0}$$

$$a_1=\left[\frac{1}{x_1} \right]$$

However, this kind of expansion will not give us the above sequences. We will get faster growing entries. Moreover, the fraction will be finite for any rational number. For example, in the list notation:

$$\frac{3}{29}=[9,28]$$

You can easily check this expansion for any rational number.

As for the constant above we get:

$$\frac{e^2-3}{e^2+1}=[1,3,31,74,315,750,14286,\dots]$$

Not the same as $[1,2,3,4,5,6,7,\dots]$ above!

We have similar sequences growing exponentially for any irrational number I checked.

$$e-2=[1,6,121,284,1260,3404,25678,\dots]$$

$$\pi-3=[7,224,471,2195,10493,46032,119223,\dots]$$

By the way, if we try CF convergents, we get almost the same expansion, but finite:

$$\frac{355}{113}-3=[7,225]$$

$$\frac{4272943}{1360120}-3=[7,224,471,2195,18596,227459,\dots]$$

So, the convergents of this sequence are not the same as for the simple continued fraction, but similar.

Comparing the expansion by the method above and the closed forms at the top of the post, we can see that, unlike for simple continued fractions, this expansion is not unique. Can we explain why?

Here is the Mathematica code to compute the limit of the first fraction:

```
Nm = 50;
Cf = Table[j, {j, 1, Nm}];
b0 = (Cf[[Nm]] - 1)/(Cf[[Nm]] + 1);
Do[b1 = N[(Cf[[Nm - j]] - b0)/(Cf[[Nm - j]] + b0), 7500];
b0 = b1, {j, 1, Nm - 2}]
N[b0/Cf[[1]], 50]
```

And here is the code to obtain the expansion in the usual way:

```
x = (E^2 - 3)/(E^2 + 1);
x0 = x;
Nm = 27;
Cf = Table[1, {j, 1, Nm}];
Do[If[x0 != 0, a = Floor[1/x0];
x1 = N[(1 - x0 a)/(x0 a + 1), 19500];
Print[j, " ", a, " ", N[x1, 16]];
Cf[[j]] = a;
x0 = x1], {j, 1, Nm}]
b0 = (1 - 1/Cf[[Nm]])/(1 + 1/Cf[[Nm]]);
Do[b1 = N[(1 - b0/Cf[[Nm - j]])/(1 + b0/Cf[[Nm - j]]), 7500];
b0 = b1, {j, 1, Nm - 2}]
N[x - b0/Cf[[1]], 20]
```

**Update**

I have derived the forward recurrence relations for numerator and denominator:

$$p_{n+1}=(a_n-1)p_n+2a_{n-1}p_{n-1}$$ $$q_{n+1}=(a_n-1)q_n+2a_{n-1}q_{n-1}$$

They have the same form as for generalized continued fractions (a special case). Now I understand why the expansions are not unique.