Factorial Calculator

Enter any non-negative integer from 0 to 170

Result:

Calculate the factorial of any non-negative integer with our free online factorial calculator. Get instant results with step-by-step calculations and scientific notation for large values.

What is a Factorial?

The factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. By definition, 0! = 1.

Factorial Formula

n! = n × (n-1) × (n-2) × ... × 2 × 1
Special case: 0! = 1

Factorial Properties

Basic Properties
  • 0! = 1 (by definition)
  • 1! = 1
  • n! = n × (n-1)!
  • Recursive nature: Each factorial builds on the previous
  • Growth rate: Extremely fast growth
Mathematical Uses
  • Permutations: P(n,r) = n!/(n-r)!
  • Combinations: C(n,r) = n!/(r!(n-r)!)
  • Series expansions: Taylor series
  • Probability: Arrangements and orderings
  • Calculus: Integration and differentiation

Step-by-Step Factorial Examples

Problem: Calculate 5!

Step-by-step solution:

5! = 5 × 4 × 3 × 2 × 1

5! = 5 × 4! = 5 × 24 = 120

Result: 5! = 120

Special cases:

0! = 1 (by mathematical definition)

1! = 1

Why 0! = 1? This definition makes mathematical formulas work consistently, especially in combinatorics where C(n,0) = n!/0! = 1.

Problem: Calculate 10!

Method 1 - Direct calculation:

10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1

Method 2 - Using previous result:

10! = 10 × 9! = 10 × 362,880 = 3,628,800

Result: 10! = 3,628,800

Common Factorial Values

n n! Growth Rate
01-
11×1
22×2
36×3
424×4
5120×5
6720×6
75,040×7
840,320×8
9362,880×9
103,628,800×10

Applications of Factorials

Combinatorics
  • Permutations and arrangements
  • Combinations and selections
  • Probability calculations
  • Counting principles
  • Game theory problems
Mathematical Analysis
  • Taylor series expansions
  • Stirling's approximation
  • Gamma function extensions
  • Power series convergence
  • Calculus applications
Computer Science
  • Algorithm complexity analysis
  • Recursive programming
  • Dynamic programming
  • Big O notation
  • Computational mathematics

Factorial Growth and Limits

⚠️ Extremely Fast Growth

Factorial growth is extremely rapid:

  • 20! = 2.43 × 10¹⁸ (2.4 quintillion)
  • 50! = 3.04 × 10⁶⁴ (3.04 vigintillion)
  • 100! = 9.33 × 10¹⁵⁷ (requires scientific notation)
  • 170! is approximately the largest factorial that can be represented in standard floating-point arithmetic
Stirling's Approximation: For large n, n! ≈ √(2πn) × (n/e)ⁿ

Factorial in Programming

Recursive Implementation
function factorial(n) {
    if (n === 0 || n === 1) {
        return 1;
    }
    return n * factorial(n - 1);
}

Pros: Simple, intuitive
Cons: Stack overflow risk for large n

Iterative Implementation
function factorial(n) {
    let result = 1;
    for (let i = 2; i <= n; i++) {
        result *= i;
    }
    return result;
}

Pros: Memory efficient, no stack overflow
Cons: Less intuitive than recursive

Frequently Asked Questions (FAQ)

0! = 1 by mathematical definition. This might seem counterintuitive, but it's defined this way because:

  • It makes mathematical formulas work consistently
  • There's exactly one way to arrange zero objects (the empty arrangement)
  • It ensures that n!/n! = 1 for all n ≥ 0
  • Combinatorial formulas like C(n,0) = n!/0! = 1 work correctly

Our calculator can handle up to 170! Beyond this:

  • 170! is approximately 7.26 × 10³⁰⁶
  • Larger factorials require scientific notation or special mathematical libraries
  • For very large factorials, use Stirling's approximation: n! ≈ √(2πn) × (n/e)ⁿ
  • Programming languages may have different limits based on data types

Factorials have many practical applications:

  • Permutations: Arranging people in a line, seating arrangements
  • Combinations: Selecting team members, lottery calculations
  • Probability: Card games, statistical analysis
  • Cryptography: Security algorithms and key generation
  • Physics: Statistical mechanics and quantum mechanics
  • Economics: Portfolio theory and risk analysis

Both use factorials but serve different purposes:

Permutations (Order Matters)
  • Formula: P(n,r) = n!/(n-r)!
  • Example: Arranging 3 people in a line from 5 people
  • Result: ABC is different from BAC
Combinations (Order Doesn't Matter)
  • Formula: C(n,r) = n!/(r!(n-r)!)
  • Example: Selecting 3 people from 5 people
  • Result: ABC is the same as BAC

No, factorials are only defined for non-negative integers.

  • Factorials of negative numbers are undefined in standard mathematics
  • The factorial function can be extended using the Gamma function: Γ(n+1) = n!
  • For non-integers, use the Gamma function: Γ(z) = ∫₀^∞ t^(z-1)e^(-t) dt
  • Our calculator only accepts non-negative integers (0, 1, 2, 3, ...)

Related Calculators


Calculator Categories

Explore our comprehensive collection of calculation tools organized by category. Find exactly what you need for math, science, finance, health, and more.

26

Categories
100+ Calculators
Instant Results
Search Calculators

All Categories

Choose from our specialized calculator categories

Algebra

Comprehensive algebra calculators for equations, roots, exponents, logarithms, and more

22 calculators
Explore Algebra
Area Converters

Convert between different area units including square feet, square meters, and acres

2 calculators
Explore Area Converters
Chemistry

<p>Chemistry can be a complex subject, but it doesn't have to be overwhelming! With our powerful ch…

1 calculator
Explore Chemistry
Construction

Construction calculators.

1 calculator
Explore Construction
Conversions

In today's interconnected world, converting units and measurements is a common task. But who has ti…

23 calculators
Explore Conversions
Cooking Converters

Convert between cooking measurement units including teaspoons, tablespoons, cups, and ounces

5 calculators
Explore Cooking Converters
Data Storage Converters

Convert between different data storage units including bytes, kilobytes, megabytes, and gigabytes

2 calculators
Explore Data Storage Converters
Energy Converters

Convert between different energy units including joules, calories, kWh, and BTU

1 calculator
Explore Energy Converters
Everyday Life

<p>In our busy daily lives, we often encounter situations that require quick calculations. Whether …

6 calculators
Explore Everyday Life
Finance

<p>Our finance calculators help you make smart choices about money. Whether you're saving up for so…

3 calculators
Explore Finance
Fractions

Comprehensive fraction calculators for all fraction operations

16 calculators
Explore Fractions
Health

<p>Keeping track of your health can be a challenge, but it doesn't have to be! With our amazing hea…

3 calculators
Explore Health
Length Converters

Convert between different length and distance units including meters, feet, inches, and miles

5 calculators
Explore Length Converters
Maths

Math can seem like a tough subject, but it doesn't have to be! With our awesome math calculator, yo…

87 calculators
Explore Maths
Percentage

Comprehensive percentage calculators for discounts, taxes, tips, and voting calculations

4 calculators
Explore Percentage
Physics Converters

Convert between physics units including acceleration, force, density, and angles

4 calculators
Explore Physics Converters
Power Converters

Convert between different power units including watts, horsepower, and BTU/hr

1 calculator
Explore Power Converters
Pressure Converters

Convert between different pressure units including PSI, bar, and atmospheres

2 calculators
Explore Pressure Converters
Speed Converters

Convert between different speed units including mph, kph, m/s, and knots

1 calculator
Explore Speed Converters
Sports

p>In the world of sports, even the slightest edge can make a big difference. Whether you're a profe…

1 calculator
Explore Sports
Statistics

Statistical calculators for data analysis, probability, and descriptive statistics

16 calculators
Explore Statistics
Temperature Converters

Convert between Celsius, Fahrenheit, and Kelvin temperature scales

3 calculators
Explore Temperature Converters
Time Converters

Convert between different time units including seconds, minutes, hours, days, and years

5 calculators
Explore Time Converters
Time and Date

<p>Keeping track of dates, times, and schedules can be a daunting task. Whether you're planning a p…

3 calculators
Explore Time and Date
Volume Converters

Convert between different volume and capacity units including liters, gallons, cups, and milliliters

8 calculators
Explore Volume Converters
Weight Converters

Convert between different weight and mass units including pounds, kilograms, ounces, and grams

4 calculators
Explore Weight Converters