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:


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


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


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


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


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


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;
  c = k + 1/c; d = 1/(k + d);
  h = c*d; y *= h;
  If[Abs[h - 1] <= 10^(-prec), Break[]];

We can check the agreement with the closed form:

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

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


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:


Iterating this transformation yields the continued fraction


(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


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


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}}}}$$


$$\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:
\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 ]