3tej home

Combinations Calculator C(n,k)

Count unordered selections of k items chosen from n distinct items.

C(n,k), also written as "n choose k", counts unordered subsets of size k drawn from n distinct items.

C(n,k)-
Scientific notation-
Digit count-
How is this calculated?

Formula: C(n, k) = n! / (k! (n - k)!). To avoid intermediate overflow this tool uses the symmetry C(n, k) = C(n, n - k) and the recurrence C(n, k) = product over i in 1..k of (n - k + i) / i with BigInt division. Source: standard combinatorics; see Pascal's triangle.

What is the Combinations Calculator?

The Combinations Calculator computes C(n, k), the binomial coefficient, which is the number of unordered ways to choose k items from a set of n distinct items. The defining formula is C(n, k) = n! divided by k! times (n minus k)!.

Combinations answer "how many groups of k can I form from n", treating {A, B} and {B, A} as the same group. The calculator above accepts n up to 1000 and returns the exact integer using JavaScript BigInt arithmetic so very large coefficients like C(1000, 500) are not lost to floating-point rounding. Scientific notation and digit count are shown alongside for orientation.

How the formula works

C(n, k) = n! / (k! * (n - k)!) = product over i in 1..k of (n - k + i) / i Symmetry: C(n, k) = C(n, n - k) Identity: C(n, k) = C(n - 1, k - 1) + C(n - 1, k) (Pascal's rule)

The factorial form is mathematically clean but explodes quickly: 100! has 158 digits. The product form is what the tool actually evaluates, multiplying k integers and dividing by k integers in lockstep with BigInt, so intermediate values stay bounded by the final answer. Source: Rosen, Discrete Mathematics and Its Applications (8th ed.), Section 6.3.

Worked example: poker hands

How many distinct 5 card hands can be dealt from a standard 52 card deck? Plug n = 52 and k = 5.

  1. Numerator: 52 times 51 times 50 times 49 times 48 = 311,875,200.
  2. Denominator: 5! = 5 times 4 times 3 times 2 times 1 = 120.
  3. C(52, 5) = 311,875,200 / 120 = 2,598,960.
  4. Cross check with symmetry: C(52, 5) = C(52, 47). Both return the same value.
Result: 2,598,960 distinct 5 card poker hands. Divide by 4 suits to get the number of "hand shapes" (649,740), or compute the probability of a royal flush as 4 / 2,598,960 = roughly 1 in 649,740.

Reference table of common combinations

Use casenkC(n, k)
Coin flip outcomes (5 heads in 10 flips)105252
Lottery: 6 of 4949613,983,816
Powerball white balls: 5 of 6969511,238,513
Poker hand: 5 of 525252,598,960
Bridge hand: 13 of 525213635,013,559,600
Pick 3 from 10 finalists103120
Central binomial coefficient C(20,10)2010184,756

Common pitfalls

  • Confusing C with P. Permutations P(n, k) count ordered arrangements. C(n, k) = P(n, k) / k!. Use combinations when order does not matter (committee membership, card hands), permutations when it does (race finishing order, password characters).
  • Repetition allowed. The standard formula assumes distinct items, no replacement. For combinations with replacement use C(n + k - 1, k) (multiset coefficient).
  • Off-by-one with "at least" and "exactly". The probability of "at least 3 heads in 5 flips" sums C(5, 3) + C(5, 4) + C(5, 5), not just C(5, 3).
  • Float overflow. Pure JavaScript Number arithmetic loses precision above 2^53. Always use BigInt for n above 50 or so.
  • Negative or non integer inputs. C(n, k) is defined only for non negative integers with 0 less than or equal k less than or equal n. The calculator rejects other inputs.

When to use combinations

  • Probability calculations: coin flips, dice, lottery odds, hypergeometric distributions.
  • Combinatorial counting: committee picks, team rosters, menu selections, password classes.
  • Binomial distribution: the C(n, k) factor is the leading term in P(X = k) for n Bernoulli trials.
  • Algorithm analysis: counting subsets, paths in grids, and dynamic programming state spaces.

Related calculators and references

Frequently asked questions

What is the difference between a combination and a permutation?
A combination ignores order while a permutation counts order. The set {A, B, C} has 3 permutations of size 2 (AB, BA, AC, CA, BC, CB = 6) but only 3 combinations (AB, AC, BC). The formulas relate: C(n, k) = P(n, k) divided by k factorial.
How is the binomial coefficient calculated?
The formula is C(n, k) = n! / (k! (n - k)!). The tool computes it via the product form C(n, k) = product of (n - k + i) over i for i in 1 through k, using BigInt division to avoid floating-point overflow for large n. C(52, 5) for poker hands equals 2,598,960 exactly.
What is Pascal's triangle?
Pascal's triangle is the array where each entry is the sum of the two above it. Row n contains the binomial coefficients C(n, 0) through C(n, n). Row 5 is 1, 5, 10, 10, 5, 1, which matches C(5, 0) through C(5, 5). It encodes the identity C(n, k) = C(n - 1, k - 1) + C(n - 1, k).
Are repetitions allowed in C(n,k)?
No. The basic C(n, k) assumes distinct items chosen without replacement. If repetition is allowed, the count is C(n + k - 1, k) instead. This is called multiset coefficient and counts the number of multisets of size k from n distinct kinds, useful for combinations with repetition such as dice outcomes.
Why use BigInt for large combinations?
JavaScript numbers are 64 bit floats with only 53 bits of integer precision (Number.MAX_SAFE_INTEGER = 9,007,199,254,740,991). C(100, 50) = 100,891,344,545,564,193,334,812,497,256 exceeds that by 18 orders of magnitude. BigInt holds arbitrary precision integers so the result is exact, with no rounding. The tradeoff is slower arithmetic.
What is C(n, 0) and C(n, n)?
Both equal 1. There is exactly one way to choose zero items (the empty set) and one way to choose all items (the full set). This is consistent with 0 factorial being defined as 1. By symmetry C(n, k) = C(n, n - k), so C(10, 7) = C(10, 3) = 120.

Sources

  • Rosen, Kenneth H. (2018). Discrete Mathematics and Its Applications, 8th edition, McGraw Hill, Section 6.3.
  • Graham, Knuth and Patashnik (1994). Concrete Mathematics, 2nd edition, Addison Wesley, Chapter 5.
  • NIST Digital Library of Mathematical Functions, 26.3 Binomial Coefficients.
  • Mozilla Developer Network, BigInt reference.

Last updated 2026-05-28.