Factorial Calculator
Calculates n! (n factorial), the product of all whole numbers from 1 to n, exactly, for any n from 0 to 5,000. Factorials grow extremely fast, so alongside the exact value you get the result in scientific notation, how many digits it has and how many zeros it ends with. Factorials count the ways to arrange n distinct objects in order and appear throughout probability, combinations and permutations.
- Whole numbers from 0 to 5,000 only.
Formula
n! = n × (n − 1) × (n − 2) × … × 2 × 1, with 0! = 1
- Recursive form: n! = n × (n − 1)!.
- The number of trailing zeros is ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …, one for each factor 5 paired with a factor 2.
- The value is computed exactly with whole-number arithmetic; results with more than 300 digits are shortened on screen.
- Scientific notation shows the first 10 significant digits, truncated.
10!
Inputs
- Number n: 10
10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 3,628,800, which has 7 digits and 2 trailing zeros (⌊10/5⌋ = 2).
Sources & references
Frequently asked questions
Why is 0! equal to 1?
There is exactly one way to arrange zero objects (do nothing), and the rule n! = n × (n − 1)! needs 1! = 1 × 0!, so 0! must be 1.
What are factorials used for?
Counting arrangements. The number of ways to order n different objects is n!: 5 books can be arranged on a shelf in 5! = 120 ways. Factorials also appear in combinations, permutations and probability.
How many zeros are at the end of 100!?
24: ⌊100/5⌋ + ⌊100/25⌋ = 20 + 4.
Can you take the factorial of a fraction or negative number?
Not with the ordinary definition. The gamma function extends it to non-integers (Γ(n + 1) = n!), but negative integers remain undefined.
Related calculators
Combination Calculator (nCr) Counts the number of ways to choose r items from a set of n when the order does not matter, written C(n, r), nCr or 'n choose r'. Choose whether an item can be picked more than once (combinations with repetition) and see the exact answer, even for large numbers, with the formula filled in. Use it for lottery odds, choosing a team or committee, card hands and binomial coefficients. The matching number of permutations, where order matters, is shown for comparison. Permutation Calculator (nPr) Counts the ways to choose and arrange r items from a set of n when the order matters, written P(n, r) or nPr. Choose whether items can repeat (like digits in a PIN) or not (like runners on a podium) and get the exact answer with the formula filled in. For small sets the calculator also lists the actual arrangements using letters A, B, C…, and shows the matching number of combinations where order does not matter. Exponent Calculator Raises a number to a power: enter the base b and the exponent x to get a = bˣ, including negative exponents (reciprocals), fractional exponents (roots) and very large or small results in scientific notation. You can also work backwards: find the exponent that turns a base into a given result (a logarithm), or the base that gives a result for a given exponent (a root). The working shows what the exponent means, such as repeated multiplication or a root.