How do you find the factorial of large numbers?

1 Answer
May 1, 2016

It depends how accurately you want to know the value.

Explanation:

The normal recursive formula for #n!# is:

#{ (0! = 1), (n! = n * (n-1)! color(white)(000) n > 0) :}#

This is completely accurate but involves a lot of multiplication and digits.

There are formulae to give you approximations, to save you having to do so many multiplications.

To get a rough order of magnitude figure you can use Stirling's approximation:

#n! ~ sqrt(2 pi n)(n/e)^n#

A much better approximation with an error of about #1/n^5# is given by the corrected formula:

#n! ~~ sqrt(2 pi n)(n/e)^n e^(1/(12n)-1/(360n^3))#