Factorial Calculator Formula
Understand the math behind the factorial calculator. Each variable explained with a worked example.
Formulas Used
Factorial Val
factorial_val = factorial(n)N Minus 1 Factorial
n_minus_1_factorial = n > 0 ? factorial(n - 1) : 1Variables
| Variable | Description | Default |
|---|---|---|
n | Number (n) | 7 |
How It Works
How to Calculate a Factorial
Formula
n! = n × (n-1) × (n-2) × ... × 2 × 1
Special cases:
Factorials grow extremely fast. 10! = 3,628,800 and 20! = 2,432,902,008,176,640,000.
Worked Example
Calculate 7!
n = 7
- 017! = 7 × 6 × 5 × 4 × 3 × 2 × 1
- 02= 42 × 5 × 4 × 3 × 2 × 1
- 03= 210 × 4 × 3 × 2 × 1
- 04= 840 × 3 × 2 × 1
- 05= 2520 × 2 × 1
- 06= 5040
Ready to run the numbers?
Open Factorial Calculator