BBy Bot
Jun 09'24

Exercise

[math] \newcommand{\NA}{{\rm NA}} \newcommand{\mat}[1]{{\bf#1}} \newcommand{\exref}[1]{\ref{##1}} \newcommand{\secstoprocess}{\all} \newcommand{\NA}{{\rm NA}} \newcommand{\mathds}{\mathbb}[/math]

A more refined inequality for approximating [math]n![/math] is given by

[[math]] \sqrt{2\pi n}\left(\frac ne\right)^n e^{1/(12n + 1)} \lt n! \lt \sqrt{2\pi n}\left(\frac ne\right)^n e^{1/(12n)}\ . [[/math]]

Write a computer program to illustrate this inequality for [math]n = 1[/math] to 9.