Robbins bounds for Stirling's formula (source code)

= Robbins bounds for Stirling's formula
{c}
{title2=$e^{1/(12n+1)}<n!/S_n<e^{1/(12n)}$}

For every positive <integer> $n$, Herbert Robbins's bounds give
$$
\boxed{S_n e^{1/(12n+1)}<n!<S_n e^{1/(12n)}.}
$$
Equivalently, the remainder in $\log(n!)=\log S_n+r_n$ satisfies $1/(12n+1)<r_n<1/(12n)$. This both proves that $S_n$ underestimates $n!$ and squeezes $n!/S_n$ to one, establishing <Stirling's formula>. Robbins published the bounds in “A Remark on Stirling's Formula” in 1955. https://dornsife.usc.edu/sergey-lototsky/wp-content/uploads/sites/211/2024/02/Stirling-Robbins.pdf[Herbert Robbins, American Mathematical Monthly 62 (1955), pp. 26–29, equations (1)–(2)]{ref}

For $n=10$, the <relative error> of $S_{10}$ lies strictly between $1-e^{-1/121}$ and $1-e^{-1/120}$, approximately $0.823\%$ and $0.830\%$. A bound specifies the accuracy of an approximation before using it in another calculation.