A Lot Of Tools
Toggle language
Toggle theme

Factorial Calculator

Calculate factorial (n!), double factorial (n!!), subfactorial (!n), and gamma function (Γ). Supports large numbers up to 1000! with exact precision.

Factorial Calculator

n! = 1 × 2 × 3 × ... × n

How to Use the Factorial Calculator

Select the type of factorial calculation, enter a non-negative integer (or any number for gamma function), and click Calculate. Results include digit count and trailing zeros for large factorials.

Types of Factorials

Factorial (n!)

The factorial of n is the product of all positive integers from 1 to n. By convention, 0! = 1. Factorials grow extremely fast - 20! already exceeds 2 quintillion.

Double Factorial (n!!)

The double factorial multiplies every other integer down to 1 or 2. For odd n: n!! = n × (n-2) × ... × 3 × 1. For even n: n!! = n × (n-2) × ... × 4 × 2.

Subfactorial (!n)

The subfactorial counts derangements - permutations where no element appears in its original position. For example, !4 = 9 represents the 9 ways to rearrange {1,2,3,4} so no number is in its original spot.

Gamma Function Γ(n)

The gamma function extends factorial to all complex numbers except non-positive integers. For positive integers, Γ(n) = (n-1)!. It also handles fractional values like Γ(0.5) = √π.

Applications

  • Counting permutations and combinations
  • Probability calculations
  • Taylor series expansions
  • Statistical distributions
  • Quantum mechanics and physics

Trailing Zeros in Factorials

The number of trailing zeros in n! equals the number of times 10 divides into it. Since 10 = 2 × 5, and there are always more 2s than 5s in factorials, we count factors of 5: ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + ...