# Stirling's Approximation and Ramanujan's Proof of Bertrand's Postulate

Perhaps, the most astounding step in Ramanujan's proof of Betrand's postulate is his application of Stirling's approximation.

He starts with the following inequality:

$\log\Gamma(x) - 2\log\Gamma(\frac{1}{2}x + \frac{1}{2}) \le \log[x]! - 2\log[\frac{1}{2}x]! \le \log\Gamma(x+1) - 2\log\Gamma(\frac{1}{2}x + \frac{1}{2})$

Then, applying Stirling's approximation, Ramanujan gets to:

$\log[x]! - 2\log[\frac{1}{2}x]! < \frac{3}{4}x$ if $x > 0$

and

$\log[x]! - 2\log[\frac{1}{2}x]! > \frac{2}{3}x$ if $x > 300$

I would be very interested in understanding how Stirling's approximation gets us to these two conclusions.

As I understand it, Ramanujan is refering to Stirling's Approximation for the Gamma function which as I understand to be this (from Wikipedia):

$\Gamma(z) = \sqrt{\frac{2\pi}{z}}(\frac{z}{e})^{z}(1 + O(\frac{1}{z}))$

If someone could provide the details, I would greatly appreciate it! :-)

• Taking logarithms of the approximation you wrote down yields $\log\Gamma(z) = \frac12\log\frac{2\pi}z + z\log\frac ze + O(\frac1z)$. If you plug in $z$ and $\frac z2$, you'll get an asymptotic formula for $\log\Gamma(z)-2\log\Gamma(\frac z2)$ that should be of help to you. – Greg Martin Mar 27 '13 at 8:03
• @Greg, Thanks for the tip. So, this will help: $\log\Gamma(z) - 2\log\Gamma(\frac{z}{2}) \sim \frac{1}{2}\log\frac{2\pi}{z} + z\log\frac{z}{e} - \log\frac{4\pi}{z} - z\log\frac{z}{2e}$ – Larry Freeman Mar 28 '13 at 4:55
• Yes, which simplifies to $z\log2 + a\log z + b + O(1/z)$ for some constants $a$ and $b$. – Greg Martin Mar 28 '13 at 5:45
• ok. So, proving $\log[x]! - 2\log[\frac{1}{2}x]! > \frac{2}{3}x$ if $x > 300$ consists of showing that $\log\Gamma(301) - 2\log\Gamma(\frac{301}{2}) > (\frac{2}{3})*{301}$ and $\frac{d}{dx}(\log\Gamma(x) - 2\log\Gamma(\frac{1}{2}x)) > \frac{2}{3}$. Is that right? – Larry Freeman Mar 28 '13 at 13:47
• That would certainly suffice. Although I wouldn't translate $x>300$ into $x\ge301$: there's no reason $x$ must be an integer here. – Greg Martin Mar 28 '13 at 16:20

To make the bounds explicit we can start with the earlier form of Stirling's Approximation $$\log \Gamma(z) = \left(z-\frac{1}{2}\right)\log z - z + \frac{1}{2}\log (2\pi) + \sum_{n=1}^{k-1} \frac{B_{2n}}{2n(2n-1)z^{2n-1}}+R_k(z)$$ If we take $k-1$ terms in the sum then $|R_k|$ is bounded by the $k$th term (see the answers to this question and the citations). In particular take $k=1$ then $|R_1|\le\frac{1}{12z}$.
Then \begin{align} \log \Gamma(z)-2\log\Gamma\left(\frac{z+1}{2}\right) &= z\log2-z\log\frac{z+1}{z}-\frac{1}{2}\log\frac{2\pi z}{e^2}+R_1(z)-2R_1\left(\frac{z+1}{2}\right)\\ &=z\log2+\Delta_1(z) \\ &=\frac{2}{3}z + (Az + \Delta_1(z)) \end{align} where $A=\log 2-2/3=0.02648\cdots$. Now we need to find the minimum $z$ that guarantees $Az+\Delta_1(z)>0$. Using $|R_1(z)-2R_1((z+1)/2)|< \frac{5}{12z}$ numerically we find $z>126$ is sufficient.
For the other side \begin{align} \log \Gamma(z+1)-2\log\Gamma\left(\frac{z+1}{2}\right) &= z\log2+\frac{1}{2}\log\frac{z+1}{2\pi}+R_1(z+1)-2R_1\left(\frac{z+1}{2}\right)\\ &=z\log2+\Delta_2(z) \\ &=\frac{3}{4}z - (Bz - \Delta_2(z)) \end{align}
where $B=3/4-\log 2=0.05685\cdots$. Using $|R_1(z+1)-2R_1((z+1)/2)|\le \frac{5}{12(z+1)}$ we find that $Bz-\Delta_2(z)>0$ for all $z>0$.