TITLE: An infinite series plus a continued fraction by Ramanujan
QUESTION [45 upvotes]: Here is a famous problem posed by Ramanujan

Show that $$\left(1 + \frac{1}{1\cdot 3} + \frac{1}{1\cdot 3\cdot 5} + \cdots\right) + \left(\cfrac{1}{1+}\cfrac{1}{1+}\cfrac{2}{1+}\cfrac{3}{1+}\cfrac{4}{1+\cdots}\right) = \sqrt{\frac{\pi e}{2}}$$

The first series seems vaguely familiar if we consider the function $$f(x) = x + \frac{x^{3}}{1\cdot 3} + \frac{x^{5}}{1\cdot 3\cdot 5} + \cdots$$ and note that $$f'(x) = 1 + xf(x)$$ so that $y = f(x)$ satisfies the differential equation $$\frac{dy}{dx} - xy = 1, y(0) = 0$$ The integrating factor here comes to be $e^{-x^{2}/2}$ so that $$ye^{-x^{2}/2} = \int_{0}^{x}e^{-t^{2}/2}\,dt$$ and hence $$f(x) = e^{x^{2}/2}\int_{0}^{x}e^{-t^{2}/2}\,dt$$ Thus the sum of the first series is $$f(1) = \sqrt{e}\int_{0}^{1}e^{-t^{2}/2}\,dt$$ But I have no idea about the continued fraction and still more I am not able to figure out how it would simplify to $\sqrt{\pi e/2}$ at the end.
Please provide any hints or suggestions.
Update: We have $$\begin{aligned}f(1) &= \sqrt{e}\int_{0}^{1}e^{-t^{2}/2}\,dt = \sqrt{e}\int_{0}^{\infty}e^{-t^{2}/2}\,dt - \sqrt{e}\int_{1}^{\infty}e^{-t^{2}/2}\,dt\\
&= \sqrt{\frac{\pi e}{2}} - \sqrt{e}\int_{1}^{\infty}e^{-t^{2}/2}\,dt\end{aligned}$$ and hence we finally need to establish $$\sqrt{e}\int_{1}^{\infty}e^{-t^{2}/2}\,dt = \cfrac{1}{1+}\cfrac{1}{1+}\cfrac{2}{1+}\cfrac{3}{1+}\cfrac{4}{1+\cdots}$$ On further searching in Ramanujan's Collected Papers I found the following formula $$\int_{0}^{a}e^{-x^{2}}\,dx = \frac{\sqrt{\pi}}{2} - \cfrac{e^{-a^{2}}}{2a+}\cfrac{1}{a+}\cfrac{2}{2a+}\cfrac{3}{a+}\cfrac{4}{2a+\cdots}$$ and it seems helpful here. But unfortunately proving this formula seems to be another big challenge for me.

REPLY [6 votes]: The formula given by Ramanujan relating $\pi$ and $e$ is proven in [1] chapter 12 Entry 43 pg.166:
$$
\sqrt{\frac{\pi e^x}{2x}}=\frac{1}{x+}\frac{1}{1+}\frac{2}{x+}\frac{3}{1+}\frac{4}{x+}...+\left\{1+\frac{x}{1\cdot3}+\frac{x^2}{1\cdot3\cdot5}+\frac{x^3}{1\cdot3\cdot5\cdot7}+...\right\}
$$
The 'hard' term in Ramanujan's formula is the continued fraction. Fortunately the continued fraction can be evaluated in terms of $\textrm{Erfc}(x)$ function. More precicely holds for $Re(b)>0$ ([2] in Appendix pg.578):
$$
\lambda(a,b):=\frac{\int^{\infty}_{0}t^a\exp\left(-bt-t^2/2\right)dt}{\int^{\infty}_{0}t^{a-1}\exp\left(-bt-t^2/2\right)dt}=\frac{a}{b+}\frac{a+1}{b+}\frac{a+2}{b+}\frac{a+3}{b+}\dots
$$
Set
$$
K:=\frac{1}{x+}\frac{1}{1+}\frac{2}{x+}\frac{3}{1+}\frac{4}{x+}...
$$
Then one can see easily 
$$
K=\frac{1}{x+}\frac{\sqrt{x}}{\sqrt{x}+}\frac{2}{\sqrt{x}+}\frac{3}{\sqrt{x}+}\ldots
$$
Setting $a=1$ and $b=\sqrt{x}$ in $\lambda(a,b)$, we get 
$$
K=\frac{1}{x+\sqrt{x}S}
$$
where 
$$
S=\lambda(1,\sqrt{x})=\frac{1}{\sqrt{x}+}\frac{2}{\sqrt{x}+}\frac{3}{\sqrt{x}+}\ldots
=\frac{\int^{\infty}_{0}te^{-t\sqrt{x}-t^2/2}}{\int^{\infty}_{0}e^{-t\sqrt{x}-t^2/2}}
=\frac{e^{-x/2}\sqrt{\frac{2}{\pi}}}{\textrm{Erfc}\left(\sqrt{\frac{x}{2}}\right)}-\sqrt{x}
$$
Hence
$$
K=\sqrt{\frac{\pi e^x}{2x}}\textrm{Erfc}\left(\sqrt{\frac{x}{2}}\right)
$$
Also the value of the sum in Ramanujan's formula is 
$$
\sqrt{\frac{e^x\pi}{2}}\textrm{Erf}\left(\sqrt{\frac{x}{2}}\right)
$$
From all the above the result follows.
[1]: B.C.Berndt, Ramanujan`s Notebooks Part II. Springer Verlag, New York, 1989.
[2]: L.Lorentzen and H.Waadeland, Continued Fractions with Applications. Elsevier Science Publishers B.V., North Holland, 1992.
About the question for second identity we have:
Let $n$ be non negative integer, then we set
$$
G_n(x,y):=\int^{\infty}_{0}t^{x+n}\exp\left(-yt-t^2/2\right)dt
$$
With integration by parts we have
$$
G_n(a,b)=\int^{\infty}_{0}\frac{d}{dt}\left(\frac{t^{a+n+1}}{a+n+1}\right)\exp\left(-bt-t^2/2\right)dt=
$$
$$
=0-\int^{\infty}_{0}\frac{t^{a+n+1}}{a+n+1}\exp\left(-bt-t^2/2\right)(-b-t)dt=
$$
$$
=b\frac{G_{n+1}(a,b)}{a+n+1}+\frac{G_{n+2}(a,b)}{a+n+1}
$$
Hence setting $t_n=\frac{G_{n+1}(a,b)}{G_{n}(a,b)}$, $n=0,1,2,\ldots$ we have
$$
t_n=\frac{n+a+1}{b+t_{n+1}}
$$
and consequently
$$
t_0=\frac{G_1(a,b)}{G_0(a,b)}=\lambda(a+1,b)=\frac{a+1}{b+}\frac{a+2}{b+}\frac{a+3}{b+}\ldots
$$