What a Factorial Means in Math
The factorial function is written as n! and is defined for non-negative integers. It multiplies every whole number from 1 up to n. Factorials appear throughout mathematics because they count how many ways you can arrange, order, and select items. In everyday terms, factorial answers “how many different ordered outcomes exist?”
If you have n distinct objects, the number of ways to arrange them in a line is n!. This is why factorial is central in permutations, combinations, probability, statistics, and discrete math. It also appears in calculus and analysis, including Taylor series expansions where terms often include n! in the denominator.
Factorial Definition and Examples
Factorial is defined by a product rule:
n! = n × (n−1) × (n−2) × … × 2 × 1, for n ≥ 1
0! = 1
A few quick examples make the growth pattern clear:
| n | n! | Explanation |
|---|---|---|
| 0 | 1 | Defined as 1 for consistency in counting formulas |
| 1 | 1 | 1 |
| 5 | 120 | 5×4×3×2×1 |
| 10 | 3,628,800 | Rapid growth with each additional factor |
Why 0! Equals 1
The definition 0! = 1 is not arbitrary. It ensures that recursive factorial relationships remain true:
n! = n × (n−1)!
If n = 1, then 1! = 1 × 0! ⇒ 0! must be 1
It also preserves combinatorics identities. For example, the number of ways to choose 0 items from n is 1, and the binomial coefficient formula uses factorials.
Double Factorial and Step Factorial
Beyond n!, you may see n!! (double factorial). It multiplies only every other integer and depends on whether n is even or odd:
n!! = n × (n−2) × (n−4) × … × 2 (if n is even)
n!! = n × (n−2) × (n−4) × … × 1 (if n is odd)
A step factorial generalizes this idea using step size k:
n!k = n × (n−k) × (n−2k) × … until the term is positive
Step factorials show up in certain series and counting problems, and are also a convenient way to represent products with consistent spacing.
Permutations (nPr) and Why Factorial Matters
Permutations count ordered selections. If you want to select and order r items from n distinct items, the count is:
nPr = n! / (n−r)!
This calculator also provides the product expansion form, which is often more efficient and more intuitive:
nPr = n × (n−1) × (n−2) × … × (n−r+1)
Trailing Zeros in n!
Trailing zeros are the number of zeros at the end of n!. They come from factors of 10, and each 10 is made from 2×5. In factorial products, 2s appear far more frequently than 5s, so the number of trailing zeros equals the number of times 5 divides into n!.
zeros(n!) = ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …
This is why 100! ends with many zeros. The calculator computes trailing zeros instantly without needing to evaluate the full factorial.
Digit Count and Scientific Notation
Factorials become huge quickly. A practical way to describe very large results is to show the number of digits and a scientific notation approximation (mantissa × 10^exponent). This is helpful in probability and statistics where you often compare sizes rather than reading the entire integer.
This tool can display factorials exactly using BigInt (integer-exact arithmetic), and it can also display a compact scientific form for readability. If the exact number is too long on small screens, use the display mode selector.
Common Uses of Factorials
- Permutations: arranging items in order (nPr)
- Combinations: choosing items without order (nCr)
- Probability: counting equally likely outcomes
- Statistics: distributions and combinatorial coefficients
- Series: Taylor/Maclaurin expansions often include 1/n!
Limits and Valid Inputs
Standard factorial is defined for non-negative integers. This calculator validates inputs and treats factorial variants as integer products. For non-integer generalizations (Gamma function), you would use a different tool. For practical planning and discrete math tasks, integer factorial forms cover the vast majority of factorial queries.
FAQ
Factorial Calculator – Frequently Asked Questions
Quick answers about factorial definitions, variants, large-number behavior, and trailing zeros.
A factorial (written n!) is the product of all positive integers from 1 to n. For example, 5! = 5×4×3×2×1 = 120. Factorials are used in permutations, combinations, probability, and series expansions.
0! is defined as 1. This convention keeps many formulas consistent, including combinations and recursive definitions of factorials.
Double factorial multiplies integers with the same parity: n!! = n×(n−2)×(n−4)×… until 1 or 2. For example, 8!! = 8×6×4×2 = 384.
A step factorial multiplies terms decreasing by a fixed step k: n!k = n×(n−k)×(n−2k)×… stopping at a positive term. It generalizes the double factorial (k=2).
Factorials grow extremely fast. Even 50! has 65 digits, and 100! has 158 digits. This calculator supports very large exact results using BigInt, plus scientific notation for readability.
Trailing zeros are the number of zeros at the end of n!. They come from factors of 10, which are made from 2×5. Since 2s are plentiful, trailing zeros are determined by how many times 5 divides into n!.
Use the formula: zeros = ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + … until the division becomes 0.
Yes. You can display a step-by-step multiplication expansion and the first/last terms for large inputs.
Standard factorial is defined for non-negative integers. For non-integers, the Gamma function generalizes factorial, but this calculator focuses on integer factorial variants.