Factorial Calculator

Calculate factorials (n!), permutations (nPr), combinations (nCr), and gamma functions with step-by-step solutions

💡 Maximum value: 170 (due to JavaScript number limits)

Factorial Result

Factorial Formula: n! = n × (n-1) × ... × 2 × 1
Recursive Formula: n! = n × (n-1)!
Base Case: 0! = 1, 1! = 1
💡 Permutations: Order matters (ABC ≠ BAC)

Permutation Result

Permutation Formula: nPr = n! / (n-r)!
Condition: 0 ≤ r ≤ n
Special Case: nP0 = 1, nPn = n!
💡 Combinations: Order doesn't matter (ABC = BAC)

Combination Result

Combination Formula: nCr = n! / (r! × (n-r)!)
Symmetry: nCr = nC(n-r)
Special Cases: nC0 = 1, nCn = 1
💡 Gamma function extends factorials to real numbers

Gamma Function Result

Gamma Function: Γ(z) = ∫₀^∞ t^(z-1) e^(-t) dt
For Integers: Γ(n) = (n-1)!
Recursion: Γ(z+1) = z × Γ(z)

How to Use the Factorial Calculator

Our comprehensive factorial calculator handles factorials, permutations, combinations, and gamma functions with detailed explanations:

❗ Factorial (n!)

Calculate n! = n × (n-1) × (n-2) × ... × 2 × 1 for non-negative integers. By definition, 0! = 1. Factorials grow extremely rapidly - 10! = 3,628,800 and 20! exceeds 2 quintillion.

🔄 Permutations (nPr)

Count arrangements where order matters. Formula: nPr = n!/(n-r)!. Example: Arranging 3 people from 5 candidates = 5P3 = 60 ways. Used in scheduling, rankings, and sequence problems.

🎯 Combinations (nCr)

Count selections where order doesn't matter. Formula: nCr = n!/(r! × (n-r)!). Example: Choosing 3 people from 5 candidates = 5C3 = 10 ways. Used in lottery, team selection, and probability.

📊 Gamma Function Γ(z)

Extends factorials to real numbers: Γ(n) = (n-1)! for positive integers. Γ(z+1) = z × Γ(z) for all z > 0. Essential in statistics, physics, and advanced mathematics.

🧮 Key Differences

• Permutations vs Combinations: ABC and BAC are different permutations but the same combination
• Factorials: Only for non-negative integers
• Gamma Function: Works for any positive real number
• Applications: Combinatorics, probability, statistics, and discrete mathematics

💡 Practical Applications

• Statistics: Probability distributions, sampling methods
• Computer Science: Algorithm analysis, complexity theory
• Cryptography: Key generation, security protocols
• Games: Lottery odds, card game probabilities
• Research: Experimental design, data analysis

🔧 Pro Tips

• Large factorials are displayed in scientific notation
• Maximum factorial: 170! (JavaScript number limits)
• Use combinations for selection problems
• Use permutations for arrangement problems
• Verify results with the recursive formulas provided

Frequently Asked Questions

0! = 1 by mathematical convention and logical necessity. It ensures the recursive formula n! = n × (n-1)! works for n = 1. Also, there's exactly one way to arrange zero objects: do nothing. This definition is crucial for many mathematical formulas in combinatorics and probability.
Permutations count arrangements where order matters (ABC ≠ BAC), while combinations count selections where order doesn't matter (ABC = BAC = CBA). For example, arranging 3 books from 5 uses permutations (5P3 = 60), but choosing 3 books regardless of order uses combinations (5C3 = 10).
JavaScript's Number type has a maximum value of approximately 1.8 × 10^308. Since 171! ≈ 1.2 × 10^309, it exceeds this limit and results in Infinity. For larger factorials, specialized big number libraries or approximations like Stirling's formula are needed.
The gamma function Γ(z) extends factorials to real numbers: Γ(n) = (n-1)! for positive integers. It's used in statistics (gamma distribution), physics (quantum mechanics), and advanced mathematics. For non-integer values, it's calculated using numerical approximations or special algorithms.
Use the relationship nPr = nCr × r!. Also check: nCr = nC(n-r) (symmetry property), and nPr should always be ≥ nCr for the same n and r. For small values, you can manually count arrangements or selections to verify the formulas work correctly.