スターリングの近似
log  Γ ( z ) = C 2 + C 1 z + z log  z − log  z 2 + i ∫ 0 ∞ − log  ( z + i t ) + log  ( z − i t ) e 2 π t − 1 d t = C 2 + C 1 z + ( z − 1 2 ) log  z + 2 ∫ 0 ∞ arctan  ( t / z ) e 2 π t − 1 d t {\displaystyle {\begin{aligned}\log \Gamma (z)&=C_{2}+C_{1}z+z\log z-{\frac {\log z}{2}}+i\int _{0}^{\infty }{\frac {-\log(z+it)+\log(z-it)}{e^{2\pi t}-1}}dt\\&=C_{2}+C_{1}z+\left(z-{\frac {1}{2}}\right)\log z+2\int _{0}^{\infty }{\frac {\arctan(t/z)}{e^{2\pi t}-1}}dt\\\end{aligned}}}
R z > 0 {\displaystyle \Re z>0} なら | tan  ( t / z ) | < M {\displaystyle |\tan(t/z)|<M} は有界であるから
k=m+1,m+2,...,n に対して足し合わせると
log  n ! m ! = ∑ k = m + 1 n log  k > ∫ m n log  x d x + ∑ k = m + 1 n 1 2 k > ∫ m n log  x d x + 1 2 n − 1 2 m + ∫ m n 1 2 x d x = ( n + 1 / 2 ) log  n − n + 1 / ( 2 n ) − ( m + 1 / 2 ) log  m + m − 1 / ( 2 m ) log  n ! m ! = ∑ k = m + 1 n log  k < ∫ m n log  x d x + 1 2 { log  n − log  m } = ( n + 1 / 2 ) log  n − n − ( m + 1 / 2 ) log  m + m {\displaystyle {\begin{aligned}\log {\frac {n!}{m!}}&=\sum _{k=m+1}^{n}\log k\\&>\int _{m}^{n}\log x\,dx+\sum _{k=m+1}^{n}{\frac {1}{2k}}\\&>\int _{m}^{n}\log x\,dx+{\frac {1}{2n}}-{\frac {1}{2m}}+\int _{m}^{n}{\frac {1}{2x}}\,dx\\&=(n+1/2)\log n-n+1/(2n)-(m+1/2)\log m+m-1/(2m)\\\log {\frac {n!
精度を改善するために an を評価する。
log  a m a m + 1 = log  m ! − ( m + 1 2 ) log  m + m − log  ( m + 1 ) ! + ( m + 3 2 ) log  ( m + 1 ) − m − 1 = ( m + 1 2 ) log  ( 1 + 1 m ) − 1 = ( m + 1 2 ) ∑ k = 1 ∞ ( − 1 ) k − 1 k 1 m k − 1 = ∑ k = 0 ∞ ( − 1 ) k k + 1 1 m k + ∑ k = 1 ∞ ( − 1 ) k − 1 2 k 1 m k − 1 = ∑ k = 2 ∞ ( k − 1 ) ( − 1 ) k 2 k ( k + 1 ) 1 m k {\displaystyle {\begin{aligned}\log {\frac {a_{m}}{a_{m+1}}}&=\log m!-\left(m+{\frac {1}{2}}\right)\log m+m-\log(m+1)!+\left(m+{\frac {3}{2}}\right)\log(m+1)-m-1\\&=\left(m+{\frac {1}{2}}\right)\log \left(1+{\frac {1}{m}}\right)-1\\&=\left(m+{\frac {1}{2}}\right)\sum _{k=1}^{\infty }{\frac {(-1)^{k-1}}{k}}{\frac {1}{m^{k}}}-1\\&=\sum _{k=0}^{\infty }{\frac {(-1)^{k}}{k+1}}{\frac {1}{m^{k}}}+\sum _{k=1}^{\infty }{\frac {(-1)^{k-1}}{2k}}{\frac {1}{m^{k}}}-1\\&=\sum _{k=2}^{\infty }{\frac {(k-1)(-1)^{k}}{2k(k+1)}}{\frac {1}{m^{k}}}\end{aligned}}}