# Estimates for Stirling's formula remainder

It is proved in Advanced Calculus by Angus Taylor, § 20.8, that

$$\log n!=\log \left( \left( \frac{n}{e}\right) ^{n}\sqrt{2\pi n}\right) +r_{n},$$

where

$$r_{n}=\sum_{k=1}^{\infty }S_{k}$$

with

$$S_{k}=\sum_{p=n+1}^{\infty }\frac{k}{2(k+1)(k+2)p^{k+1}}.$$

This formula for $r_{n}$ provides a method for finding the estimate

$$\frac{1}{12\left( n+1\right) }<r_{n}<\frac{1}{12\left( n-1\right) }.$$

Indeed

$$\frac{1}{k\left( n+1\right) ^{k}}=\sum_{p=n+1}^{\infty }\int_{p}^{p+1}\frac{% 1}{x^{k+1}}\mathrm dx<\sum_{p=n+1}^{\infty }\frac{1}{p^{k+1}}$$

$$\sum_{p=n+1}^{\infty }\frac{1}{p^{k+1}}<\sum_{p=n+1}^{\infty }\int_{p-1}^{p}% \frac{1}{x^{k+1}}\mathrm dx=\frac{1}{kn^{k}},$$

and so

$$\frac{1}{2(k+1)(k+2)\left( n+1\right) ^{k}}<S_{k}<\frac{1}{2(k+1)(k+2)n^{k}}$$

$$\frac{1}{12\left( n+1\right) }<\sum_{k=1}^{\infty }\frac{1}{% 2(k+1)(k+2)\left( n+1\right) ^{k}}<r_{n}<\sum_{k=1}^{\infty }\frac{1}{% 2(k+1)(k+2)n^{k}}<\frac{1}{12\left( n-1\right) }.$$

Added:The Wikipedia article pointed to in the comment gives an approximation based on the Euler-MacLaurin formula in terms of the Bernoulli numbers and states that it can also be obtained by repeated integration by parts. The Stirling series that appears in the same article is different from the one above.

Question (edited): Are there better estimates of $r_{n}$ based on different methods?

-
This might be of interest: en.wikipedia.org/wiki/… – Hans Lundmark Dec 2 '10 at 13:46
@Hans Lundmark, Thanks. Now I am more pessimist of getting better answers than the Wikipedia entry. – Américo Tavares Dec 2 '10 at 14:34
I recall reading a paper that used both the trapezoidal rule and the midpoint rule to generate Stirling's formula with remainder; however, since the truncation error of those two quadrature methods is in fact the Euler-Maclaurin formula in a different garb, that approach might as well be duplicating that which is already in Wikipedia. – J. M. Dec 2 '10 at 14:50

$$\frac{1}{12n} - \frac{1}{360n^3} < r_n < \frac{1}{12n}$$
and (the interesting part) that the constant $1/360$ cannot be improved. I confess to not having read the paper closely.