Closed form for a pair of continued fractions

What is $1+\cfrac{1}{2+\cfrac{1}{3+\cfrac{1}{4+\cdots}}}$ ?

What is $1+\cfrac{2}{1+\cfrac{3}{1+\cdots}}$ ?

It does bear some resemblance to the continued fraction for $e$, which is $2+\cfrac{2}{2+\cfrac{3}{3+\cfrac{4}{4+\cdots}}}$.

Another thing I was wondering: can all transcendental numbers be expressed as infinite continued fractions containing only rational numbers? Of course for almost all transcendental numbers there does not exist any method to determine all the numerators and denominators.

Solutions Collecting From Web of "Closed form for a pair of continued fractions"

The first one is expressible in terms of the modified Bessel function of the first kind:

$$1+\cfrac1{2+\cfrac1{3+\cfrac1{4+\cdots}}}=\frac{I_0(2)}{I_1(2)}=1.433127426722\dots$$

The second one, through an equivalence transformation, can be converted into the following form:

$$1+\cfrac1{\frac12+\cfrac1{\frac23+\cfrac1{\frac38+\cfrac1{b_4+\cdots}}}}$$

where $b_k=\dfrac{k!!}{(k+1)!!}$ and $k!!$ is a double factorial. By Van Vleck, since

$$\sum_{k=1}^\infty \frac{k!!}{(k+1)!!}$$

diverges, the second continued fraction converges. This CF can be shown to be equal to

$$\frac1{\tfrac1{\sqrt{\tfrac{e\pi}{2}}\mathrm{erfc}\left(\tfrac1{\sqrt 2}\right)}-1}=1.904271233329\dots$$

where $\mathrm{erfc}(z)$ is the complementary error function.


Establishing the value of the “continued fraction constant” (a short sketch)

From the modified Bessel differential equation, we can derive the difference equation

$$Z_{n+1}(x)=-\frac{2n}{x}Z_n(x)+Z_{n-1}(x)$$

where $Z_n(x)$ is any of the two solutions $I_n(x)$ or $K_n(x)$. Letting $x=2$, we obtain

$$Z_{n+1}(2)=-n\,Z_n(2)+Z_{n-1}(2)$$

We can divide both sides of the recursion relation with $Z_n(2)$ and rearrange a bit, yielding

$$\frac{Z_n(2)}{Z_{n-1}(2)}=\cfrac1{n+\cfrac{Z_{n+1}(2)}{Z_n(2)}}$$

A similar manipulation can be done in turn for $\dfrac{Z_{n+1}(2)}{Z_n(2)}$; iterating that transformation yields

$$\frac{Z_n(2)}{Z_{n-1}(2)}=\cfrac1{n+\cfrac1{n+1+\cfrac1{n+2+\cdots}}}$$

Now, we don’t know if $Z$ is $I$ or $K$; the applicable theorem at this stage is Pincherle’s theorem. This states that $Z$ is necessarily the minimal solution of the associated difference equation if and only if the continued fraction converges (which it does, by Śleszyński–Pringsheim). Roughly speaking, the minimal solution of a difference equation is the unique solution that “decays” as the index $n$ increases (all the other solutions, meanwhile, are termed dominant solutions). From the asymptotics of $I$ and $K$, we find that $I$ is the minimal solution of the difference equation ($K$ and any other linear combination of $I$ and $K$ constitute the dominant solutions). By Pincherle, then, the continued fraction has the value $\dfrac{I_n(2)}{I_{n-1}(2)}$. Taking $n=1$ and reciprocating gives the first CF in the OP.


Here’s a short Mathematica script for evaluating the “continued fraction constant”, which uses the Lentz-Thompson-Barnett method for the evaluation:

prec = 50;
y = N[1, prec]; c = y; d = 0; k = 2;
While[True,
  c = k + 1/c; d = 1/(k + d);
  h = c*d; y *= h;
  If[Abs[h - 1] <= 10^(-prec), Break[]];
  k++];
y
1.4331274267223117583171834557759918204315127679060

We can check the agreement with the closed form:

y - BesselI[0, 2]/BesselI[1, 2] // InputForm
0``49.70728038020511

Alternative expressions for the second continued fraction

Just to thoroughly beat the stuffing out of this question, I’ll talk about a few other expressions that are equivalent to the OP’s second CF.

One can build the Euler-Minding series of the continued fraction:

$$1+\sum_{k=0}^\infty \frac{(-1)^k (k+2)!}{B_k B_{k+1}}$$

where $B_k$ is the denominator of the $k$-th convergent of the continued fraction, which satisfies the difference equation $B_k=B_{k-1}+(k+1)B_{k-2}$, with initial conditions $B_{-1}=0$, $B_0=1$. OEIS has a record of this sequence, but there is no mention of a closed form.

One can also split the original continued fraction into odd and even parts, yielding the following contractions:

$$3-\cfrac{6}{8-\cfrac{20}{12-\cfrac{42}{16-\cdots}}}\qquad \text{(odd part)}$$

$$\cfrac1{1-\cfrac{2}{6-\cfrac{12}{10-\cfrac{30}{14-\cdots}}}}\qquad \text{(even part)}$$

The utility of these two contractions is that they converge twice as fast as the original continued fraction, as well as providing “brackets” for the value of the continued fraction.


Much, much later:

Prompted by GEdgar’s question, I have found that the second CF does have a nice closed form. Here is a derivation:

The iterated integrals of the complementary error function, $\mathrm{i}^n\mathrm{erfc}(z)$ (see e.g. Abramowitz and Stegun) satisfy the difference equation

$$\mathrm{i}^{n+1}\mathrm{erfc}(z)=-\frac{z}{n+1}\mathrm{i}^n\mathrm{erfc}(z)+\frac1{2(n+1)}\mathrm{i}^{n-1}\mathrm{erfc}(z)$$

with initial conditions $\mathrm{i}^0\mathrm{erfc}(z)=\mathrm{erfc}(z)$ and $\mathrm{i}^{-1}\mathrm{erfc}(z)=\dfrac2{\sqrt\pi}\exp(-z^2)$.

This recurrence can be rearranged:

$$\frac{\mathrm{i}^n\mathrm{erfc}(z)}{\mathrm{i}^{n-1}\mathrm{erfc}(z)}=\frac1{2z+2(n+1)\tfrac{\mathrm{i}^{n+1}\mathrm{erfc}(z)}{\mathrm{i}^n\mathrm{erfc}(z)}}$$

Iterating this transformation yields the continued fraction

$$\frac{\mathrm{i}^n\mathrm{erfc}(z)}{\mathrm{i}^{n-1}\mathrm{erfc}(z)}=\cfrac1{2z+\cfrac{2(n+1)}{2z+\cfrac{2(n+2)}{2z+\dots}}}$$

(As a note, $\mathrm{i}^n\mathrm{erfc}(z)$ can be shown to be the minimal solution of its difference equation; thus, by Pincherle, the CF given above is correct.)

In particular, the case $n=0$ gives

$$\frac{\sqrt\pi}{2}\exp(z^2)\mathrm{erfc}(z)=\cfrac1{2z+\cfrac2{2z+\cfrac4{2z+\cfrac6{2z+\dots}}}}$$

If $z=\dfrac1{\sqrt 2}$, then

$$\frac{\sqrt{e\pi}}{2}\mathrm{erfc}\left(\frac1{\sqrt 2}\right)=\cfrac1{\sqrt 2+\cfrac2{\sqrt 2+\cfrac4{\sqrt 2+\cfrac6{\sqrt 2+\dots}}}}$$

We now perform an equivalence transformation. Recall that a general equivalence transformation of a CF

$$b_0+\cfrac{a_1}{b_1+\cfrac{a_2}{b_2+\cfrac{a_3}{b_3+\cdots}}}$$

with some sequence $\mu_k, k>0$ looks like this:

$$b_0+\cfrac{\mu_1 a_1}{\mu_1 b_1+\cfrac{\mu_1 \mu_2 a_2}{\mu_2 b_2+\cfrac{\mu_2 \mu_3 a_3}{\mu_3 b_3+\cdots}}}$$

If we apply this to the CF earlier with $\mu_k=\dfrac1{\sqrt 2}$, then

$$\sqrt{\frac{e\pi}{2}}\mathrm{erfc}\left(\frac1{\sqrt 2}\right)=\cfrac1{1+\cfrac1{1+\cfrac2{1+\cfrac3{1+\dots}}}}$$

Thus,

$$\frac1{\tfrac1{\sqrt{\tfrac{e\pi}{2}}\mathrm{erfc}\left(\tfrac1{\sqrt 2}\right)}-1}=1+\cfrac2{1+\cfrac3{1+\cfrac4{1+\dots}}}$$

I don’t know if either of the continued fractions can be expressed in terms of common functions and constants. However, all real numbers can be expressed as a continued fractions containing only integers. The continued fractions terminate for rational numbers, repeat for a quadratic algebraic numbers, and neither terminate nor repeat for other reals.

Shameless plug: There are many references out there for continued fractions. I wrote a short paper that is kind of dry and covers only the basics (nothing close to the results that J. M. cites), but it goes over the results that I mentioned.

I know how to do these. Here is the second question.

First, a more natural one:
$$
1+\cfrac{1}{1+\cfrac{2}{1+\cfrac{3}{1+\ddots}}}=
\frac{1}{\displaystyle e^{1/2}\sqrt{\frac{\pi}{2}}\;\mathrm{erfc}\left(\frac{1}{\sqrt{2}}\right)}
\approx 1.525135276\cdots
$$
So the original one is
$$
1+\cfrac{2}{1+\cfrac{3}{1+\ddots}} =
\frac{1}{\displaystyle \frac{1}{ e^{1/2}\sqrt{\frac{\pi}{2}}\;\mathrm{erfc}\left(\frac{1}{\sqrt{2}}\right)}-1}
\approx 1.9042712\cdots
$$

[erfc is here ]