—
—
3
1
—
—
3
1
The Combinations Calculator computes the number of ways to choose r items from n items without regard to order — denoted C(n, r), ⁿCᵣ, or "n choose r." Combinations are fundamental to combinatorics, probability theory, statistics, and countless applications from lottery odds to genetic analysis. Unlike permutations, combinations treat selections as unordered sets: choosing {A, B, C} is the same as choosing {C, A, B}.
This calculator handles values up to n = 170 using a logarithmic gamma function approach, avoiding overflow issues that plague direct factorial computation. It provides both the exact combination count and its base-10 logarithm for extremely large values.
The number of combinations is given by the binomial coefficient formula:
$$C(n, r) = \binom{n}{r} = \frac{n!}{r!(n-r)!}$$
Where n! (n factorial) is the product of all positive integers up to n. Direct computation of factorials leads to overflow for even moderate values (170! ≈ 7.26 × 10³⁰⁶), so this calculator uses the log-gamma function approach:
$$\ln C(n,r) = \ln \Gamma(n+1) - \ln \Gamma(r+1) - \ln \Gamma(n-r+1)$$
Where Γ(x) is the gamma function satisfying Γ(n+1) = n! for non-negative integers. The log-gamma function is computed using Stirling's approximation:
$$\ln \Gamma(x) \approx \frac{1}{2} \ln\frac{2\pi}{x} + x\left(\ln\left(x + \frac{1}{12x - \frac{1}{10x}}\right) - 1\right)$$
This approach converts the multiplication of extremely large numbers into addition of their logarithms, maintaining numerical precision across the entire valid range.
Key properties of combinations: C(n, 0) = C(n, n) = 1 (one way to choose nothing or everything), C(n, 1) = n (n ways to choose one item), and the symmetry property C(n, r) = C(n, n-r). The binomial coefficients form Pascal's triangle, where each entry is the sum of the two entries above it.
The result tells you how many distinct groups of size r can be formed from n items when order doesn't matter. For lottery analysis, C(49, 6) = 13,983,816 tells you there are nearly 14 million possible ticket combinations. For committee selection, C(20, 5) = 15,504 possible 5-person committees from 20 candidates.
The log₁₀ output is useful for extremely large values where the combination count exceeds what can be displayed as an integer. A log₁₀ value of 15 means approximately 10¹⁵ combinations.
Inputs
Results
The classic 6/49 lottery has C(49,6) = 13,983,816 possible combinations. Your probability of winning the jackpot with one ticket is 1/13,983,816 ≈ 0.0000072%. This is why lotteries are sometimes called a 'tax on people who don't understand probability.'
Inputs
Results
The number of possible 5-card poker hands is C(52,5) = 2,598,960. This is the denominator for calculating poker hand probabilities. For example, there are only 4 possible royal flushes, so P(royal flush) = 4/2,598,960 ≈ 0.000154%.
Combinations count unordered selections — choosing {A, B} is the same as {B, A}. Permutations count ordered arrangements — (A, B) and (B, A) are different. Mathematically, P(n, r) = C(n, r) × r!, meaning permutations equal combinations multiplied by the number of ways to arrange r items. Use combinations when order doesn't matter (committees, lottery draws, card hands) and permutations when it does (rankings, sequences, PIN codes).
This is the symmetry property: choosing r items to include is equivalent to choosing (n-r) items to exclude. Selecting 3 people from 10 for a committee is the same as selecting 7 people to NOT be on the committee. Both processes produce the same groups. Mathematically: n!/(r!(n-r)!) = n!/((n-r)!r!). This property is computationally useful — C(100, 97) = C(100, 3) = 161,700 is much faster to compute using r = 3.
Pascal's triangle is a triangular array where each entry is a binomial coefficient C(n, r). Row n contains C(n, 0), C(n, 1), ..., C(n, n). Each entry equals the sum of the two entries above it: C(n, r) = C(n-1, r-1) + C(n-1, r). This recursive relationship, combined with the boundary conditions C(n, 0) = C(n, n) = 1, generates the entire triangle. It appears in algebra (binomial expansion), probability (binomial distribution), and number theory (divisibility patterns).
This calculator supports n up to 170. Beyond 170, the factorial exceeds the range of standard floating-point numbers (170! ≈ 7.26 × 10³⁰⁶, while the maximum double-precision float is about 1.8 × 10³⁰⁸). The log-gamma approach provides accurate results within this range. For larger values, the log₁₀ output remains meaningful even when the actual count is astronomically large. For exact integer arithmetic with very large n, specialized arbitrary-precision libraries are needed.
Combinations are the foundation of counting-based probability. To find P(event), compute (favorable combinations)/(total combinations). Examples: P(flush in poker) = C(4,1)×C(13,5) / C(52,5); P(exactly k successes in n trials) = C(n,k)×p^k×(1-p)^(n-k) (binomial distribution). Whenever you need to count "how many ways" something can happen without caring about order, combinations are the right tool.
The multinomial coefficient generalizes combinations to more than two groups. It counts the ways to divide n items into groups of sizes k₁, k₂, ..., kₘ where k₁+k₂+...+kₘ = n. The formula is n!/(k₁!×k₂!×...×kₘ!). For example, distributing 12 books into groups of 4, 4, and 4 gives 12!/(4!×4!×4!) = 34,650 ways. The binomial coefficient C(n,r) is the special case with two groups of sizes r and n-r.
Roboculator Team
The Roboculator Team explains calculations, planning tools, and practical formulas in clear language for real-life situations.
How helpful was this calculator?
Be the first to rate!
Lottery Odds Calculator
Probability Calculators
Probability Calculator
Probability Calculators
Conditional Probability Calculator
Probability Calculators
Monty Hall Problem Calculator
Probability Calculators
Permutations Calculator (nPr)
Probability Calculators
Combinations with Replacement Calculator
Probability Calculators