Math Calculators

Factorial Calculator

Calculate factorials, double factorials, derangements and gamma values. Understand exact counts, shortened displays and finite-range limits.

Jump to calculator ↓Help me choose a test

Common Factorial Values

0!
1
1!
1
2!
2
3!
6
4!
24
5!
120
6!
720
7!
5,040
8!
40,320
9!
362,880
10!
3,628,800
12!
479,001,600

Reference

Factorial (n!): Product of all positive integers up to n.
n! = n × (n-1) × (n-2) × ... × 1
Double Factorial (n!!): Product of integers with same parity.
n!! = n × (n-2) × (n-4) × ...
Subfactorial (!n): Number of derangements (permutations with no fixed points).
!n = n! × Σ(-1)^k/k! for k=0 to n
Gamma Function Γ(n): Extension of factorial to real numbers.
Γ(n) = (n-1)! for positive integers

Four calculations with different meanings

n! counts orderings of n distinct items. n!! multiplies every second positive integer. !n counts derangements—permutations where no item remains in its original position. Γ(z) extends the factorial relationship: Γ(n)=(n−1)! for positive integers.

Factorial and derangement modes use nonnegative whole numbers. The conventional values are 0!=1, 1!=1, !0=1 and !1=0. Double-factorial mode also permits −1, with (−1)!!=1. Gamma has poles at nonpositive integers and is evaluated by a numerical approximation elsewhere.

Reproduce the examples

For n=5, 5!=120, 5!!=5×3×1=15, and !5=44. For gamma, enter 5 to obtain Γ(5)=24, not 120. Entering 0.5 gives Γ(0.5)=√π≈1.772453851.

The integer calculations use BigInt. Large outputs are shown in shortened scientific notation with a digit count; the shortened mantissa does not display every exact digit. Factorial accepts up to 1000, while double factorial and derangements have smaller limits shown in validation messages.

Gamma uses finite floating-point arithmetic. Inputs with nonfinite output are rejected; this is not an arbitrary-precision gamma calculator. Its numerical approximation and the exact integer modes have different accuracy properties.

Interpretation and limits

A factorial is a count, not a probability. Rearranging repeated indistinguishable items needs a correction: arrangements of AAB total 3!/2!=3. More complex restrictions may require another counting argument.

Do not confuse Γ(n) with Γ(n+1)=n!, or double factorial with (n!)!. Mode changes clear the old result so its label cannot accidentally describe a different calculation.

Continue

Read counting principles and use the combinations/permutations tool for selections.

Want to learn the theory?

Our lessons explain the statistical concepts behind this calculator with clear examples.

Understand this method →