The factorial of a whole number is the product of every integer from one up to it, so 5 factorial is 1 times 2 times 3 times 4 times 5, which is 120. It shows up in permutations, combinations, probability and in the formulas used to size real engineering designs. This factorial calculator handles any value from zero upwards and gives you the exact integer, the digit count and a scientific notation form for the very large results.
What Is the Factorial Calculator?
A factorial counts the number of ways a set of items can be arranged or selected, which is why it appears so often in probability, in the calculation of combinations of a test result, and in the permutation formulas used for scheduling and routing.
The calculator gives you the exact integer value, which is more useful than a rounded figure because factorials grow so quickly. It also reports the number of digits, since a result of 88 digits is best appreciated by its size.
How the Factorial Works
n! = n × (n − 1) × (n − 2) × … × 2 × 1
Two special cases are worth remembering. Zero factorial is defined as 1, because there is exactly one way to arrange an empty set, namely to leave it alone. One factorial is also 1.
The values grow faster than exponentially. Ten factorial is 3,628,800, twenty factorial is about 2.4 times 10 to the 18, and one hundred factorial has 158 digits. That rapid growth is why factorials are almost always used as intermediate values inside a larger formula rather than as an answer in themselves.
Permutations and Combinations
Permutations and combinations both start from n factorial but count different things. A permutation of n items taken r at a time counts the ordered arrangements, so the order of the items matters: how many ways to award gold, silver and bronze to three runners from eight finalists is 8 times 7 times 6.
A combination counts unordered selections, so the order does not matter. Choosing three flavours of ice cream from eight available is a combination, and dividing n factorial by both r factorial and the factorial of n minus r removes the double counting of order.
Precision Limits
Standard double precision floating point numbers hold integers exactly up to about 2 to the 53, which is 16 digits. Factorials pass that limit at 18 factorial, where the value is 6,402,373,705,728,000.
Up to 170 factorial the value is still returned exactly, because the number of significant digits stays within what the format can represent. Beyond that the calculator stops, because showing digits that are not exactly correct would be worse than showing nothing.
Frequently Asked Questions
What is 0 factorial?
Zero factorial is 1. It is the convention that makes the counting formula work, since there is exactly one way to arrange nothing, and it keeps the recursive definition consistent at the boundary.
How big is 100 factorial?
One hundred factorial is a 158 digit number beginning 9.3326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000.
What is the difference between nPr and nCr?
Permutations count ordered arrangements, so choosing two of five gives 20, while combinations count unordered selections and give 10. Divide by r factorial to convert one into the other.
Can factorials handle decimal numbers?
No. Factorials are defined for non-negative integers. Extensions such as the gamma function cover fractional values, but the simple product definition only applies to whole numbers.
Why is the factorial of a negative number not defined?
The product for a negative number would run backwards through zero and never terminate, so there is no finite value. The gamma function extends the idea to negative fractions but not to negative integers.