阶乘计算器公式

How to Calculate a Factorial

Formula

n! = n × (n-1) × (n-2) × ... × 2 × 1

Special cases:

  • 0! = 1 (by definition)
  • 1! = 1
  • Factorials grow extremely fast. 10! = 3,628,800 and 20! = 2,432,902,008,176,640,000.

    计算示例

    Calculate 7!

    1. 7! = 7 × 6 × 5 × 4 × 3 × 2 × 1
    2. = 42 × 5 × 4 × 3 × 2 × 1
    3. = 210 × 4 × 3 × 2 × 1
    4. = 840 × 3 × 2 × 1
    5. = 2520 × 2 × 1
    6. = 5040