Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Is there a way to estimate how big $n!$ is for a certain $n$? For example, without using a calculator, what is the magnitude of $7!$ or $12!$ or $100!$?

share|improve this question
1  
If you have access to a computer, Wolfram Alpha tells you the number of digits. –  Quincunx May 7 at 16:40
    
@Quincunx That comes under calculator I think :D –  Sawarnik May 8 at 6:23
    
@Sawarnik Nah, Wolfram Alpha isn't a calculator. Wolfram Alpha is a "computational knowledge machine" –  Quincunx May 8 at 6:28
2  
@Quincunx which are fancy words for "hella-big calculator" –  Darkhogg May 8 at 15:03

4 Answers 4

up vote 19 down vote accepted

Yes, Stirling's formula:

\begin{equation} n! \; \sim \; \sqrt{2\pi n} \left(\frac{n}{e}\right)^n. \end{equation}

share|improve this answer
11  
Additional thought to otherwise appropriate answer: if you don't have a calculator and want a numerical estimate, it's probably better to look at the base-10 logarithm of this. –  orion May 7 at 13:27
11  
Any equation that includes both e and pi always looks like witchcraft to me. –  mikeTheLiar May 7 at 17:36
2  
@mikeTheLiar Study complex analysis. There is no end to the witchcraft in that field. –  Goos May 7 at 19:25
3  
@Goos Alternatively, there is an immediate end to the witchcraft once you understand the relationship between exponents and angles. –  Kyle Strand May 7 at 21:59
1  
@KyleStrand I don't just mean the complex exponential. I mean the entire field of complex analysis. Maximum modulus principle, bounded entire function is constant, once-differentiable implies $C^\infty$, integration techniques, etcetera etcetera. Witchcraft. –  Goos May 8 at 0:42

Another answer in this thread suggests Stirling's approximation: $$n! \approx \sqrt{2\pi n}\biggl(\frac ne\biggr)^n$$

which I think is the right place to start for any answer to this question. However, it may be useful to add that if you take the logarithm of this amount, you get the (approximate) number of digits you need to write down $n!$, which may be of more use:

$$\begin{align} \log n! & \approx \color{darkblue}{n\log n} - n\color{maroon}{\log e} + \color{darkblue}{\frac12 \log n} + \color{darkgreen}{\frac12\log 2\pi}\\ & \approx \color{darkblue}{\biggl(n+\frac12\biggr)\log n} - \color{maroon}{0.43}\cdot n + \color{darkgreen}{0.798} \end{align} $$

($\log$ here is the common, base-10 logarithm function.)

For small $n$ this gives the following values, which I have rounded off to the nearest integer:

$$\begin{array}{rr} n & \text{length of $n!$} \\\hline 1 & 0 \\ 2 & 1 \\ 3 & 1 \\ 4 & 2 \\ 5 & 2 \\ 6 & 3 \\ 7 & 4 \\ 8 & 5 \\ 9 & 6 \\ 10 & 7 \\ 11 & 8 \\ 12 & 9 \\ 13 & 10 \\ 14 & 11 \\ 15 & 13 \\ 16 & 14 \\ 17 & 15 \\ 18 & 16 \\ 19 & 18 \\ 20 & 19 \\ \end{array} $$

This is correct for all $n$ shown except $1$ and $5$, for which it is off by 1.

share|improve this answer

A cool alternative to Stirling's formula could be the more accurate formula derived by Srinivasa Ramanujan, $$ \ln(n!) \sim n\ln(n) - n + \frac{1}{6}\ln(n(1+4n(1+2n))) + \frac{1}{2}\ln(\pi). $$

share|improve this answer
1  
But this is $log_e$, not $log_{10}$, which is what it seems the OP wants. –  Cole Johnson May 8 at 0:09
    
Sure, but it's fairly easy to convert between the two, just multiply the RHS by $\log_{10} \mathrm{e} \approx 0.4$ –  Bennett Gardiner May 8 at 0:10
    
I don't know... Multiplication is pretty hard. </sarcasm> –  Cole Johnson May 8 at 0:11
    
You could of course use logs to do multiplication </oldfogey> In any case it becomes $\log_{10}(n!) \sim n\log_{10}(n) - n \log_{10}(e) + \frac{1}{6}\log_{10}(n(1+4n(1+2n))) + \frac{1}{2}\log_{10}(\pi).$ –  Henry May 8 at 9:45

A different tack here, as you I suspect you are asking for a method that doesn't require any 'advanced' functions.

How large a positive integer number is, can be expressed well in terms of how many digits it takes to write the number. This is best represented as the integer part of the logarithm of the number, plus 1 (logarithm base 10, i.e. Log not Ln). For example LOG[55] = 1.74 (2 d.p.), it requires INT[1.74] + 1 = 2 digits to represent it. You can get a better feel for the size of a number by looking at the digits after the decimal point in the logarithm too.

Doing polynomial fits of LOG[n!] vs n gives these two useful approximate working regions.

n = 7 to 119 (cubic polynomial): LOG[n!] ~ -0.0000284659105*n^3 + 0.00943671908*n^2 + 0.962859106*n - 3.95423829 Maximum error factor in range of 2.93

n = 120 to 1000 (5th order polynomial): LOG[n!] ~ -4.68977059E-13*n^5 + 0.00000000164012606*n^4 - 0.000002402405*n^3 + 0.0021512217*n^2 + 1.6770136*n - 29.6620872 Maximum error factor in range of 1.94

You could do better with higher order polynomials, particularly in range 7 to 119, but these are good enough to tell you "how big" the factorials are.

Below 7 you should be able to do in your head :-)

share|improve this answer
    
Yes, i Was looking for something like this. I Was surprised though, by the variety of answers... So i'm checking them aswell :) –  Trux May 8 at 4:28
    
An addition, I perhaps wasn't clear what the error factor was. This is the error in n!. So n! is within a factor of 2 across the full 120 to 1000 range, LOG[n!] is within +/-0.29. –  user1228123 May 8 at 9:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.