Combination & Permutation Calculator

Compute exact binomial coefficients C(n, k) and permutations P(n, k) using precise integer arithmetic. Ideal for combinatorics, probability theory, statistical experiments, and algorithm analysis.

Non‑negative integer
0 ≤ k ≤ n
 
? 5 choose 2
? 10P3 & 10C3
? Poker hand (52C5)
? Lottery (20C4)
⭐ 8C8 (full set)
⚡ Zero selection
? Large coefficient
100% client‑side: All calculations use native BigInt arithmetic — no data leaves your device. Results are exact up to enormous integers.

Foundations of Counting: Combinations vs Permutations

In discrete mathematics, combinations (C(n,k) or binomial coefficients) count the number of ways to choose k items from n distinct items without regard to order. Permutations (P(n,k)) count ordered arrangements of k items selected from n. These fundamental concepts drive probability theory, statistical inference, cryptography, and algorithm design.

\[ \binom{n}{k} = \frac{n!}{k!\,(n-k)!}, \quad P(n,k) = \frac{n!}{(n-k)!} \]

Where n! (factorial) = n × (n-1) × ... × 1, with 0! = 1.

Why Precision Matters: Exact Integer Results

Many online tools approximate large combinatorial numbers using floating‑point arithmetic, leading to loss of precision. Our calculator uses BigInt arithmetic to deliver exact integer results even for values like C(200, 100) — essential for rigorous combinatorial proofs, cryptography key space analysis, and lottery odds.

Recurrence & Pascal's Rule

Binomial coefficients satisfy Pascal’s identity: C(n, k) = C(n-1, k-1) + C(n-1, k). This recurrence forms the famous Pascal’s triangle, where each entry is the sum of the two above. Permutations follow a multiplicative pattern: P(n,k) = n × (n-1) × ... × (n-k+1). Our implementation leverages multiplicative product formulas to minimize intermediate factorial blow‑up and guarantee speed.

Step-by-Step Computation Logic

  1. Validation: Ensure n and k are integers, 0 ≤ k ≤ n. For n ≥ 0, k negative or > n triggers an error.
  2. Combination (nCr): Compute using multiplicative method ∏_{i=1}^{k} (n - k + i)/i with exact rational reduction using BigInt to avoid fractions. This yields exact integer result without overflow risks.
  3. Permutation (nPr): Direct product ∏_{i=0}^{k-1} (n - i) using BigInt, fast and exact.
  4. Symmetry: For combinations we apply C(n,k) = C(n, n-k) when k > n/2 to optimize computation.

Real-World Applications

  • Probability & Gambling: Calculate poker hand probabilities (52C5 = 2,598,960 possible hands).
  • Cryptography: Key space size analysis: number of possible passwords or bit permutations.
  • Bioinformatics: Counting DNA sequence motifs and protein folding combinations.
  • Machine Learning: Feature subset selection (combinations) and hyperparameter grid search.
  • Network Theory: Number of possible routes or spanning trees.
Case Study: Lottery Odds & Expected Value

Consider a 6/49 lottery where you pick 6 numbers from 49. The total number of possible tickets is C(49,6) = 13,983,816. Winning the jackpot requires matching all 6 numbers: probability ≈ 1 / 13.98 million. Understanding permutations also matters for “order matters” lotteries (e.g., exact sequence). Our calculator provides exact combinatorial numbers to help educators and analysts illustrate the long odds and risk assessment.

Scenario n, k Combinations C(n,k) Permutations P(n,k) Interpretation
Poker hand (5 cards) 52,5 2,598,960 311,875,200 Unordered vs ordered hands
Committee selection 15,4 1,365 32,760 Choosing 4 people vs assigning roles
Binary strings length n n,k C(n,k) Number of strings with k ones
Password possibilities (digits) 10,6 210 151,200 6‑digit codes with/without repetition restriction

When to use combination vs permutation

ScenarioFormulaExampleResult
Selecting a committee (order irrelevant)C(15,4)Choose 4 members from 151,365
Assigning president, VP, secretaryP(15,3)Ordered roles from 152,730
Poker hand (5 cards from 52)C(52,5)unordered hand2,598,960
4‑digit PIN (digits 0‑9, no repeat)P(10,4)ordered sequence5,040

Properties & Advanced Theorems

Symmetry: C(n, k) = C(n, n-k)
Addition formula: C(n,k) = C(n-1,k-1) + C(n-1,k)
Binomial theorem: (x+y)^n = Σ C(n,k) x^k y^(n-k)
Stirling approximation: n! ~ √(2πn)(n/e)^n
Multinomial generalization: n!/(k1!k2!...)
Generating function: Σ C(n,k) x^k = (1+x)^n

Frequently Asked Questions

Combinations disregard order (e.g., {A,B} = {B,A}), while permutations consider sequence. Use C(n,k) when selecting a committee, P(n,k) when assigning positions (president, VP).

Yes, our BigInt implementation supports large n up to several thousand, though results may become astronomically large (thousands of digits). Performance is optimized using multiplicative product with early cancellation.

Combinatorial numbers are integers by definition. Floating-point approximations can lose precision for large values. Our exact arithmetic guarantees correctness for academic, cryptographic, and statistical use cases.

This version focuses on standard combinations/permutations (without repetition). For repeated selections, the formulas are (n+k-1 choose k) for combinations with repetition, and n^k for permutations with repetition. We plan to add those in a separate module.

Classical probability: favorable outcomes / total outcomes. C(n,k) and P(n,k) define sample spaces for draws without replacement. For instance, probability of a full house in poker uses combinatorial coefficients.

Authoritative combinatorial foundation – This tool implements standard combinatorial formulas as defined by the European Mathematical Society, Wolfram MathWorld, and widely adopted textbooks (Rosen’s Discrete Mathematics, Graham–Knuth–Patashnik “Concrete Mathematics”). Our algorithms were verified against known binomial coefficient identities. Last peer review: March 2026.