Factorial calculator (n!)
Compute the factorial of a whole number up to 170 and its scientific notation.
Calculator inputs
Results
Enter your values and press “Calculate” to see the result.
In short
- What it calculates
- Compute the factorial of a whole number up to 170 and its scientific notation.
- Formula used
n! = n × (n−1) × (n−2) × … × 2 × 1- Example
- 10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1
Factorial calculator
The factorial of n is the product of every positive integer up to n. It shows up in combinatorics, probability and the series expansion of many functions.
It grows extraordinarily fast: 20! already exceeds two quintillion.
How it works
The product is accumulated from 2 up to n. The limit of 170 is not arbitrary: 171! exceeds the largest number a double-precision float can represent.
Formula
n! = n × (n−1) × (n−2) × … × 2 × 1
0! = 1 by definition
n! = n × (n−1)!
Worked example
10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1
= 3,628,800
That is how many different ways 10 items can be ordered.
Explanation
Why zero factorial equals one
There is exactly one way to arrange an empty set: leave it as it is. The definition also fits the recursive rule: if the factorial of n is n times the factorial of n minus one, then the factorial of one is one times that of zero, and for it to equal one, zero factorial must be one. It is not a whim, it is consistency.
It grows faster than almost anything
Twenty factorial already exceeds two quintillion. Seventy factorial overflows most calculators. A hundred factorial has one hundred and fifty-eight digits. That growth explains why problems requiring every permutation to be tested are intractable even for powerful computers: with fifty elements there is not enough time in the universe.
The travelling salesman problem
Visiting ten cities allows over three million distinct routes. With twenty, the figure passes two quintillion. It is the classic example of why brute force fails and approximation algorithms are needed.
The gamma function extends the idea
Mathematicians defined a continuous function that matches the factorial at the integers and gives values for decimal and complex numbers. It is why one can speak of the factorial of a half.
Frequently asked questions
Why does 0! equal 1?
Because there is exactly one way to arrange an empty set, and it keeps the combinatorics formulas consistent.
Is there a factorial of a negative number?
Not for negative integers. The gamma function extends factorials to other values, but never to negative integers.
Does the factorial of a negative number exist?
Not for integers. The gamma function, which extends the factorial, is also undefined at negative integers.
What is twenty factorial?
Over two quintillion. Growth is so rapid that beyond seventy most calculators overflow.
Need to calculate something else?
These tools are often used alongside this calculator.
Combinatorics
Count how many ways you can choose or order items, with or without repetition.
Prime numbers
Check whether a number is prime and break it down into its prime factors.
Scientific
Trigonometry, logarithms, exponentials and factorials, with a degrees/radians switch.
Powers
Raise any number to an integer, decimal or negative exponent.
Calculator
Type the whole expression and get the result instantly, brackets and functions included.
Percentage
The four most common percentage calculations in a single tool.