Copyright © University of Cambridge. All rights reserved.

'Stirling Work' printed from https://nrich.maths.org/

Show menu

You are going to use a computer to work out the values of $\sqrt{n}$, $n^n$ and $e^{-n}$ for a few values of the whole number $n$.

Before you start, can you estimate values of $n$ beyond which each function is larger than $100$, $1\,000\, 000$ or $1\,000\, 000\,000\, 000$? It would be great if you could specify as tight a range as possible between which you know these values will be exceeded.

Try them out on a computer. How close were you?

Excel can cope with numbers up to about $10^{308}$ (to a precision of 16 places) What values of $n$ do you think will cause Excel to break down for each function. Were you correct?

For large n, the factorial function can be approximated very well with an expression of the following form:

$$n! \sim A n^{\pm n\pm 0.5} e^{\pm n}$$

Your challenge is to experiment using a calculator or spreadsheet to find the constant $A$ and whether or not each $\pm$ is $+$ or $-$

Warning: You will need to think about this task, as although the approximation gives a smaller and smaller percentage error as $n$ increases, the absolute error increases as $n$ increases!

When you find the correct form of the formula, can you numerically calculate some large factorials to 8 significant figures? How large a factorial will you be able to calculate?

You can now use this formula algebraically to perform calculations beyond the limit of the computer. For example, you can estimate the chance of getting $500$ heads if you toss a coin $1000$ times or (equivalently) the number of ways of choosing $500$ people from a group of $1000$ people.