Combination Calculator

Calculate combinations C(n, r) - unordered selections

About This Tool

A combination C(n, r) counts the ways to choose r items from n distinct items where order doesn't matter. The formula is n! / (r!(n−r)!), pronounced "n choose r." Combinations differ from permutations P(n, r) — permutations count ordered selections.

The calculator handles n up to several thousand using BigInt arithmetic, returning exact integer results without overflow.

The binomial coefficient C(n, r) appears across combinatorics, probability, and discrete mathematics. It counts subsets of size r in an n-element set; appears as the coefficient of x^r in the expansion of (1+x)^n (binomial theorem); and equals the number of paths in Pascal's triangle from the apex to the (n, r) position. The formula n! / (r!(n−r)!) becomes computationally expensive for large n because n! grows extremely fast — 100! has 158 digits. The efficient implementation computes C(n, r) using the recurrence C(n, r) = C(n−1, r−1) × n / r or the multiplicative formula ∏(n−i+1)/i for i = 1 to r, which avoids computing the full factorial. With BigInt, exact results are practical for n in the thousands.

A worked example: choosing a 5-card hand from a standard 52-card deck. C(52, 5) = 52! / (5! × 47!) = (52×51×50×49×48) / (5×4×3×2×1) = 311,875,200 / 120 = 2,598,960. That's the number of distinct poker hands. The calculator returns this exact value in microseconds. Comparing to permutations: P(52, 5) = 52!/47! = 311,875,200 — 120 times larger because each combination corresponds to 5! = 120 different orderings. Most card-game probability questions use combinations because the order of cards in your hand is irrelevant to the hand's value.

Limitations: combinations are for distinct items selected without repetition. For multisets (selection with repetition), use the formula C(n+r−1, r). For partial-selection problems where order partially matters, neither combinations nor permutations directly apply — those need case-specific reasoning. The calculator handles standard C(n, r) with BigInt precision; very large outputs (1000+ digits) are returned as exact integers but become unwieldy to display. For approximate values of huge combinations, Stirling's approximation gives n! ≈ √(2πn)(n/e)^n, which is accurate to within 1% for n above 10.

The about text and FAQ on this page were drafted with AI assistance and reviewed by a member of the Coherence Daddy team before publishing. See our Content Policy for editorial standards.

Frequently Asked Questions