A refinement of Ramanujan’s factorial approximation
Michael D. Hirschhorn1 and Mark B. Villarino2
1
School of Mathematics and Statistics, University of New South Wales,
Sydney NSW 2052, Australia
2
1
Escuela de Matemática, Universidad de Costa Rica
San José 11501, Costa Rica
Introduction
All we have of Ramanujan’s work in the last year of his life is about 100 pages (probably a small fraction of his final year’s output), held by Trinity College, Cambridge,
and named by George E. Andrews “Ramanujan’s Lost Notebook”. It was published
in photocopied form [4]. In it, Ramanujan [4, p. 339] makes the claim that
Γ(x + 1) =
√
x
1
x
θx 6
3
2
π
8x + 4x + x +
e
30
3
< θx < 1, and gives some numerical evidence for
where θx → 1 as x → ∞ and
10
this last statement.
Inspired by this, we confine ourselves to the positive integers, and prove the following
stronger result.
Theorem 1. Let the function, θn , be defined for n = 1, 2, . . . by the equation:
n! :=
√
n
1
n
θn 6
3
2
π
8n + 4n + n +
.
e
30
Then, the correction term θn
(a) satisfies the inequalities:
1−
79
11
79
20
11
+
< θn < 1 −
+
+
;
2
2
8n 112n
8n 112n
33n3
(1)
(b) is an increasing function of n; and
(c) is concave, that is,
θn+1 − θn < θn − θn−1 .
The inequalities (1) are new. In 2006, Hirschhorn [2] proved a less exact version
of the inequalities (1). In 2001, Karatsuba [3] proved Ramanujan’s approximation
and gave a proof, quite different from ours, of the monotonicity of the correction
1
term θx , for all real x ≥ 1, a result which is stronger than ours. Moreover, although
Karatsuba derived an asymptotic expansion for θx , including a uniform error term,
she did not derive any explicit numerical inequalities, as we do. Then, in 2003, Alzer
1
[1] proved that in (0, 1] the constant term 100
can be replaced by the best possible
min0.6≤x≤0.7 θx = 0.0100450 · · · and that the improved double inequality for θx holds
for 0 ≤ x < ∞. The monotonicity of θn was proved by Villarino, Campos-Salas, and
Carvajal-Rojas in [5] as a simple consequence of the inequality in [2]; in that paper,
the concavity of θn was also noted, without proof.
Our proofs use nothing more than the series for log (1 + x) and exp{x}.
We will find it convenient to use the following notation.
Definition 2. The notation
Pk (n)
means a polynomial of degree k in n with all of its non-zero coefficients positive.
2
The proofs
Proposition 3. The following inequality is valid for n = 1, 2, . . . :
1
1
1
1
log 1 +
−1<
−
.
0< n+
2
n
12n 12(n + 1)
(2)
Proof. We have, for |x| < 1,
log (1 + x) = x −
x2 x3
+
− ··· .
2
3
It follows that for |x| < 1,
x3 x5
1+x
=2 x+
+
+ ··· .
log
1−x
3
5
1
where n ∈ Z+ , we obtain
2n + 1
1
1
1
1
=2
+
+
+ ··· .
log 1 +
n
2n + 1 3(2n + 1)3 5(2n + 1)5
If we set x =
(3)
It follows that
1
1
1
1
n+
log 1 +
=1+
+
+ ···
2
2
n
3(2n + 1)
5(2n + 1)4
Therefore
1
1
1
0 < n+
·
log 1+
−1 <
2
n
3(2n + 1)2
1
1
1−
(2n + 1)2
=
1
1
−
.
12n 12(n + 1)
The inequality (2) leads to the following well-known version of Stirling’s formula.
2
Proposition 4. The following inequality is valid for n = 1, 2, . . . :
n
n
√
√
n
n
1
2πn
.
< n! ≤ 2πn
exp
e
e
12n
Proof. Let
(4)
. √ n n
.
n
an = n!
e
Then
an
=
an+1
1
1+
n
n+ 1
2
e = exp
1
n+
2
1
log 1 +
n
−1 .
From (2) we have
an
1
1
1<
< exp
−
.
an+1
12n 12(n + 1)
(5)
So an is decreasing and, if we write 1, 2,. . . , n − 1 for n and multiply the results, we
find
1
1
1
a1
< exp
−
< exp
,
an
12 12n
12
or,
1
11
= exp
.
an > a1 exp −
12
12
It follows that a∞ = limn→∞ an exists, and
11
.
a∞ ≥ exp
12
√
In fact, from Wallis’s product, a∞ = 2π.
If in (5) we write n, n + 1,. . . , N − 1 for n, multiply the results, let N → ∞ and use
Wallis’s product, we obtain, successively,
1
1
an
< exp
−
,
1<
aN
12n 12N
1
1
aN < an < aN exp
−
,
12n 12N
√
√
1
2π < an ≤ 2π exp
12n
and
√
n
n
√
1
n
n
.
< n! ≤ 2πn
exp
2πn
e
e
12n
We shall improve on (2), and so also on (4), by proving the next inequality.
3
Proposition 5. The following inequality is valid for n = 1, 2, . . . :
1 1
1
1
1
1
1
1
1
+
−
−
−
−
12 n n + 1
360 n3 (n + 1)3
1260 n5 (n + 1)5
1
1
1
−
−
1680 n7 (n + 1)7
1
1
< n+
log 1 +
−1
2
n
1
1
1
1
1
1
1
1 1
+
.
−
−
−
−
<
12 n n + 1
360 n3 (n + 1)3
1260 n5 (n + 1)5
Proof. We have, from (3),
1
1
1
1
1
n+
+
+
·
log 1 +
−1<
2
4
2
n
3(2n + 1)
5(2n + 1)
7(2n + 1)6
(6)
1
1−
1
(2n + 1)2
1
1
1
+
+
2
4
3(2n + 1)
5(2n + 1)
28n(n + 1)(2n + 1)4
1
1
1
1
1
1
1
1 1
+
−
−
−
−
=
12 n n + 1
360 n3 (n + 1)3
1260 n5 (n + 1)5
=
163n6 + 489n5 + 604n4 + 393n3 + 141n2 + 26n + 2
2520n5 (n + 1)5 (2n + 1)4
1 1
1
1
1
1
1
1
1
<
+
−
−
−
−
12 n n + 1
360 n3 (n + 1)3
1260 n5 (n + 1)5
−
and
1
1
1
1
1
1
n+
log 1 +
−1>
+
+
+
2
4
6
2
n
3(2n + 1)
5(2n + 1)
7(2n + 1)
9(2n + 1)8
1 1
1
1
1
1
1
1
1
=
+
−
−
−
−
12 n n + 1
360 n3 (n + 1)3
1260 n5 (n + 1)5
1
1
1
−
−
7
1680 n
(n + 1)7
P12 (n)
+
5040n7 (n + 1)7 (2n + 1)8
1 1
1
1
1
1
1
1
1
>
+
−
−
−
−
12 n n + 1
360 n3 (n + 1)3
1260 n5 (n + 1)5
1
1
1
.
−
−
1680 n7 (n + 1)7
This completes the proof.
We now demonstrate the greatly improved version of Stirling’s formula.
Proposition 6. For n = 1, 2, . . . , the following inequality is valid:
n
√
n
1
1
1
1
2πn
−
+
−
exp
e
12n 360n3 1260n5 1680n7
n
√
1
1
1
n
.
−
+
exp
≤ n! ≤ 2πn
e
12n 360n3 1260n5
4
(7)
Proof. It follows from (6) that
1 1
1
1
1
1
1
1
1
exp
+
−
−
−
−
12 n n + 1
360 n3 (n + 1)3
1260 n5 (n + 1)5
1
1
1
−
−
1680 n7 (n + 1)7
an
<
an+1
1
1 1
1
1
1
1
1
1
< exp
+
.
−
−
−
−
12 n n + 1
360 n3 (n + 1)3
1260 n5 (n + 1)5
Thus, for N > n,
1 1
1
1
1
1
1
1
1
1
1
1
exp
+
−
−
−
−
−
−
12 n N
360 n3 N 3
1260 n5 N 5
1680 n7 N 7
an
1
1
1
1
1
1
1
1 1
<
+
,
< exp
−
−
−
−
aN
12 n N
360 n3 N 3
1260 n5 N 5
and
√
n
n
1
1
1
1
2πn
+
−
−
exp
e
12n 360n3 1260n5 1680n7
n
√
1
1
1
n
.
−
+
exp
≤ n! ≤ 2πn
e
12n 360n3 1260n5
1
Extracting the fraction
from the exponents, we see that we can write this last
6
inequality in the form
√
n
1
6
n
1
1
1
1
2πn
−
+
−
exp
3
5
7
e
2n 60n
210n
280n
1
n
√
6
1
1
1
n
exp
−
+
.
≤ n! ≤ 2πn
e
2n 60n3 210n5
We now obtain upper and lower bounds for these new exponents.
Proposition 7. The following inequalities are valid for n ≥ 2:
1
1
1
1
−
+
−
exp
2n 60n3 210n5 280n7
1
1
1
11
79
>1+
+ 2+
−
+
3
4
2n 8n
240n
1920n
26880n5
(8)
and
1
1
1
exp
−
+
2n 60n3 210n5
1
1
1
11
79
1
<1+
+ 2+
−
+
+
.
3
4
5
2n 8n
240n
1920n
26880n
396n6
(9)
Assuming for the moment that these bounds are valid, we can now prove the main
result of this paper.
5
Proof of Theorem 1. It follows from Proposition 7 that for n ≥ 2,
1
n
√
6
1
1
1
11
79
n
1+
+ 2+
−
+
2πn
3
4
5
e
2n 8n
240n
1920n
26880n
1
n
√
6
1
1
1
11
79
1
n
1+
+ 2+
−
+
+
,
< n! < 2πn
e
2n 8n
240n3 1920n4 26880n5 396n6
or:
1
6
√ n n
79
1
11
3
2
π
+
8n + 4n + n +
1−
2
e
30
8n 112n
n
1
6
√ n
79
20
1
11
3
2
+
+
8n + 4n + n +
1−
.
< n! < π
e
30
8n 112n2 33n3
This beautiful formula is the refined estimate (1). It is easy to check this for n = 1
also, so we have the desired result.
To show that θn is increasing, from (1) it follows that
11
79
11
79
20
θn+1 − θn > 1 −
+
− 1−
+
+
8(n + 1) 112(n + 1)2
8n 112n2 33n3
=
(5082n2 + 7792n + 8497)(n − 2) + 14754
3696n3 (n + 1)2
>0
for
n ≥ 2,
and it is easily checked for n = 1 also, so θn is increasing.
Finally, to prove the concavity of θn , we note that:
θn+1 − 2θn + θn−1
79
20
11
+
+
<1−
8(n + 1) 112(n + 1)2 33(n + 1)3
11
79
20
11
79
+1−
+
+
−2 1−
+
8(n − 1) 112(n − 1)2 33(n − 1)3
8n 112n2
(2842n4 + 6389n3 + 15061n2 + 85733n + 433747)(n − 5) + 2166128
1848n2 (n − 1)3 (n + 1)3
< 0 for n ≥ 5,
=−
and is easily checked for n = 2, 3 and 4 also.
We complete the proof of the exponential inequalities as follows.
Proof of Proposition 7. Let q :=
1
1
1
1
−
+
−
. Then q > 0, and
3
5
2n 60n
210n
280n7
q2 q3 q4 q5
q
+
+
+
+
1!
2!
3!
4!
5!
1
1
1
11
79
=1+
+ 2+
−
+
3
4
2n 8n
240n
1920n
26880n5
P28 (n)(n − 2) + 5421638789368547485949
+
50185433088000000n35
1
1
11
79
1
+ 2+
−
+
>1+
3
4
2n 8n
240n
1920n
26880n5
exp{q} > 1 +
6
which proves (8) for n ≥ 2. Now let r :=
1
1
1
−
+
. Then r > 0, and
3
2n 60n
210n5
r
r2 r3 r4 r5 r6 r7
+
+
+
+
+
+
+ ···
1!
2!
3!
4!
5!
6!
6!
r2 r3 r4 r5 r6
r
+
+
+
+
=1+ +
(1 − r)
1!
2!
3!
4!
5!
6!
1
1
11
79
1
1
=1+
+ 2+
−
+
+
3
4
5
2n 8n
240n
1920n
26880n
396n6
P23 (n)(n − 3) + 239259521624400145687307843
−
20701491148800000n25 (420n5 − 210n4 + 7n2 − 2)
1
1
1
11
79
1
<1+
+ 2+
−
+
+
3
4
5
2n 8n
240n
1920n
26880n
396n6
exp{r} < 1 +
for
n ≥ 3,
which proves (9) for n ≥ 3. The case n = 2 is easily checked.
3
Final Remarks
The first three terms of our new inequalities (1) for θn are the best possible asymptotically while the fourth term in the upper bound is subject to improvement.
Proposition 4 and Proposition 6 are special cases of the general expansion of n!,
with an error term, which can be proved by using the Euler–Maclaurin sum formula. However, our proofs are much more elementary, and can be extended to any
degree of accuracy desired. Still, our proofs do not supply the general formula for
the coefficients in the exponential version, although perhaps they can be properly
modified to do so.
Also, our technique for proving the positivity of certain large degree polynomials
seems to argue for a general property of polynomials P (x) with real coefficients that
are positive for x ≥ a. The property in question is that there exists a b ≥ a such
that the quotient polynomial Q(x) in the division algorithm P (x) ≡ Q(x)(x − b) + R
has all its coefficients positive.
Finally, the inequalities (1) can, with more work, be extended to degrees three, four,
etc., where the main coefficients are given by the formula of Karatsuba [3].
We also conjecture that the correction term θn is completely monotonic.
Acknowledgements
We thank the referee for the reference [1]. We would like to thank Daniel CamposSalas for some helpful suggestions about the concavity. MBV acknowledges support
for the Vicerrectorı́a de Investigación of the University of Costa Rica.
References
[1] Horst Alzer, “On Ramanujan’s Double Inequality for the Gamma Function”,
Bull. London Math. Soc. 35 (2003) 601-607.
7
[2] M. D. Hirschhorn, “A New Version of Stirling’s Formula”, Mathl. Gazette 90
(2006), 286–291.
[3] E. A. Karatsuba, “On the asymptotic representation of the Euler gamma function by Ramanujan”. J. Comput. Appl. Math. 135 (2001), 225–240.
[4] S. Ramanujan, The Lost Notebook and other Unpublished Papers, S. Raghavan
and S. S. Rangachari, eds., Narosa, New Delhi, 1987.
[5] M. B. Villarino, D. Campos-Salas and J. Carvajal-Rojas, “On the monotonicity
of the correction term in Ramanujan’s factorial approximation”, Mathl. Gazette
97 (2013), to appear.
8