Due to a recent comment by Akiva about this post, I decided to revisit Ramanujan's beautiful continued fraction (plus series) relating $\pi$ and $e$,

$$\sqrt{\frac{\pi\,e}{2}} =1+\frac{1}{1\cdot3}+\frac{1}{1\cdot3\cdot5}+\frac{1}{1\cdot3\cdot5\cdot7}+\dots+\,\cfrac1{1+\cfrac{1}{1+\cfrac{2}{1+\cfrac{3}{1+\ddots}}}}$$

By sheer happenstance, I came across Pedja's post from 2021 and realized the series is also a nice continued fraction,

\begin{align} \sqrt{\frac{\pi\,e}{2}} &=1+\cfrac{2/2}{2+\cfrac{3/2}{3+\cfrac{4/2}{4+\cfrac{5/2}{5+\ddots}}}} \; + \; \cfrac1{1+\cfrac{1}{1+\cfrac{2}{1+\cfrac{3}{1+\ddots}}}}\\[4pt] &=1.41068613\dots + 0.65567954\dots = 2.06636567\dots \end{align}

where the decimal expansions are OEIS A060196, A108088, A059444, respectively. The first continued fraction does not appear in Mathworld's Continued Fraction Constants, but the reciprocal of the second does and is labeled as $C_3 \approx 1/0.65567954 \approx 1.5251352.$

After a session with Mathematica, one can observe that Ramanujan's general form (Entry 43, "Chapter 12 of Ramanujan's Second notebook: Continued fractions") for this identity have addends that have closed-forms. Let,

$$A = \sum_{n=0}^\infty \prod_{k=0}^n\frac{x^n}{2k+1} = \sqrt{\frac{\pi\,e^x}{2x}} \operatorname{erf}\Big(\sqrt{\tfrac x 2}\Big)$$

$$B = \cfrac1{1+\cfrac{1}{x+\cfrac{2}{1+\cfrac{3}{x+\ddots}}}} = \sqrt{\frac{\pi\,e^x}{2x}} \left(1-\operatorname{erf}\Big(\sqrt{\tfrac x 2}\Big)\right)$$

with error function $\operatorname{erf}(z).$ Therefore,

$$\sqrt{\frac{\pi\,e^x}{2x}} = A+B$$

for $x>0$. The first identity was just the case $x=1$.


  1. For general $x>0$, can we express the series $A$ as a continued fraction similar to the one above?
  2. Likewise, can we express the continued fraction $B$ as a series similar to $A$?
  • 1
    $\begingroup$ Nice problem (as usual !) $\endgroup$ Oct 22, 2023 at 6:24
  • 1
    $\begingroup$ From browsing the comments from other posts, we have the alternative form, $$\sum_{n=0}^\infty 2^n\cdot\frac{z^{2n+1}}{(2n+1)!!} = \frac{\sqrt{\pi}\,e^{z^2}}{2}\,\operatorname{erf}(z)$$ With a change of variables $z=\sqrt{\frac x 2},\,$ we recover Ramanujan's $A$, $$A=\sum_{n=0}^\infty \frac{x^n}{(2n+1)!!} = \sqrt{\frac{\pi\,e^x}{2x}}\,\operatorname{erf}\left(\sqrt{\tfrac x 2}\right)$$ and the cfrac as the special case $x=1$. $\endgroup$ Oct 23, 2023 at 6:37
  • $\begingroup$ This is great for sure $\endgroup$ Oct 23, 2023 at 6:44
  • $\begingroup$ @ClaudeLeibovici It seems the story is not finished yet. There may be a cubic counterpart to Ramanujan's identity in this sequel. $\endgroup$ Oct 23, 2023 at 11:22


You must log in to answer this question.