Evaluation of a continued fraction

Puzzle question... I know how to solve it, and will post my solution if needed; but those who wish may participate in the spirit of coming up with elegant solutions rather than trying to teach me how to solve it. [paraphrased from Lone Learner]

Prove (or disprove) the following equality: $$1+\cfrac1{1+\cfrac2{1+\cfrac3{1+\ddots}}}=\frac1{\displaystyle e^{1/2}\sqrt{\frac{\pi}{2}}\;\mathrm{erfc}\left(\frac1{\sqrt2}\right)}\approx 1.525135276\cdots$$

(taken from Closed form for a pair of continued fractions)


The iterated integral of the complementary error function,

$$\begin{align*} \mathrm{i}^n\mathrm{erfc}(z)&=\underbrace{\int_z^\infty\int_{t_{n-1}}^\infty\cdots\int_{t_1}^\infty}_{n} \mathrm{erfc}(t)\,\mathrm dt\cdots\mathrm dt_{n-2}\mathrm dt_{n-1}\\ &=\frac2{n!\sqrt\pi}\int_z^\infty(t-z)^n\exp(-t^2)\,\mathrm dt \end{align*}$$

(see e.g. Abramowitz and Stegun) satisfies 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, it can be shown that $\mathrm{i}^n\mathrm{erfc}(z)$ is the minimal solution (that is, $\mathrm{i}^n\mathrm{erfc}(z)$ decays as $n$ increases) 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}}}$$

You can easily show that an equivalence transformation leaves the value of the CF unchanged.

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

The CF in the OP is now easily obtained from this.


Let \begin{align*} p_n &= p_{n-1}+np_{n-2}, \quad p_{-1} = 1, \quad p_0=1, \\ q_n &= q_{n-1}+nq_{n-2}, \quad q_{-1} = 0, \quad q_0=1, \\ r_n &= \frac{p_n}{q_n}. \end{align*} So the $r_n$ are the convergents of the continued fraction: $$ r_0 = 1,\qquad r_1 = 1+\cfrac{1}{1},\qquad r_2 = 1+\cfrac{1}{1+\cfrac{2}{1}},\qquad r_3 = 1+\cfrac{1}{1+\cfrac{2}{1+\cfrac{3}{1}}}, $$ and so on. Consider the exponential generating functions $$ F(x) = \sum_{n=0}^\infty \frac{p_{n-1}}{n!}\,x^n,\qquad G(x) = \sum_{n=0}^\infty \frac{q_{n-1}}{n!}\,x^n . $$ They are solutions of the differential equations \begin{align*} &F'(x) + (-1-x)F(x) = 0,\quad F(0)=1, \\ &G'(x) + (-1-x)G(x) = 1,\quad G(0)=0 . \end{align*} A solution for the homogeneous equation $y'+(-1-x)y=0$ is $$ F_1(x) = e^{(1+x)^2/2} $$ and a particular solution for the inhomogeneous equation $y'+(-1-x)y=1$ is $$ F_2(x) = \sqrt{\frac{\pi}{2}}\,e^{(1+x)^2/2}\, \mathrm{erf}\,\frac{x+1}{\sqrt{2}} $$ After all, there are formulas for the solution of first-order linear differential equations.

Hayman's method (Wilf, generatingfunctionology, Theorem 4.5.1) shows that the coefficients of $F_1$ are asymptotic to $$ \frac{e^{n/2+\sqrt{n}+1/4}}{2n^{(n+1)/2}\sqrt{\pi}} $$ as $n \to \infty$ and the coefficients of $F_2$ are asymptotic to $$ \frac{e^{n/2+\sqrt{n}+1/4}}{2\sqrt{2}n^{(n+1)/2}} $$
Applying the initial conditions, we conclude that $$ F(x) = e^{-1/2}F_1(x),\qquad G(x) = F_2(x)-\sqrt{\frac{\pi}{2}}\,\mathrm{erf}\,\frac{1}{\sqrt{2}} \,F_1(x) $$
So \begin{align*} \frac{p_{n-1}}{n!} &\sim \frac{e^{n/2+\sqrt{n}-1/4}}{2n^{(n+1)/2}\sqrt{\pi}}; \\ \frac{q_{n-1}}{n!} &\sim \frac{e^{n/2+\sqrt{n}+1/4}} {2\sqrt{2}n^{(n+1)/2}} - \frac{e^{n/2+\sqrt{n}+1/4}\sqrt{\pi}\text{erf}(1/\sqrt{2})} {2\sqrt{2}n^{(n+1)/2}\sqrt{\pi}} = \frac{e^{n/2+\sqrt{n}-1/4}e^{1/2}\text{erfc}(1/\sqrt{2})} {2\sqrt{2}n^{(n+1)/2}} \end{align*} with $\text{erfc}(x)=1-\text{erf}(x)$. Finally, $$ \frac{p_{n-1}}{q_{n-1}} \sim \frac{1}{\displaystyle e^{1/2}\;\sqrt{\frac{\pi}{2}}\;\text{erfc}\,\frac{1}{\sqrt{2}}} \approx 1.525135276 $$ so that is the value of the continued fraction.