Permutation & Combination Calculator

Share:

Compute permutations P(n,r) and combinations C(n,r) with full step-by-step breakdown. BigInt support for very large numbers — lottery odds, deck enumeration, statistics.

RT-CNV-080 · Mathematics

Permutation & Combination Calculator

Permutation P(n, r)
= n! / (n−r)! — ORDER matters
Combination C(n, r)
= n! / (r! × (n−r)!) — order does NOT matter
n!
r!
(n−r)!
Enter valid n and r values (r must be ≤ n, both non-negative)
Advertisement
After results · AD-W1Responsive · Post-tool — peak engagement

How to use the Permutation & Combination Calculator

Determine if order matters

The key conceptual distinction: Permutation = ORDER matters (1-2-3 different from 3-2-1). Use for lock combinations, race finishes, sequencing. Combination = order does NOT matter (1-2-3 same as 3-2-1). Use for lottery draws, poker hands, committee selection. If your problem treats {A,B,C} and {C,B,A} as the same outcome → combination. If they're different outcomes → permutation.

Enter n (total pool) and r (selected count)

n = the total number of items available to choose from. r = how many you're selecting. Examples: 6/49 lottery → n=49, r=6 (choosing 6 numbers from 49). 5-card poker → n=52, r=5. 4-digit PIN → n=10, r=4 (with permutation since order matters, but PINs allow repeats so the math is actually 10⁴ not P(10,4)). Race finishes top-3 from 8 runners → n=8, r=3 (permutation since 1st-2nd-3rd order matters).

Read both results — they relate by r!

P(n,r) = C(n,r) × r! — meaning permutations are always r-factorial times larger than combinations. For C(5,3) = 10, the corresponding P(5,3) = 60 (since 3! = 6). This is because for every UNORDERED combination of 3 items, there are 3! = 6 ORDERED arrangements. The factorial breakdown below shows n!, r!, and (n-r)! so you can verify the math by hand for small cases.

Common applications: lottery odds, poker probabilities

6/49 lottery odds: 1 in C(49,6) = 13,983,816. Adding a bonus ball or larger pool dramatically worsens odds. 5-card poker: C(52,5) = 2,598,960 hands. Royal flushes are exactly 4 of these (one per suit), so probability = 4/2,598,960 = 1 in 649,740. The calculator handles up to n=1000 with full BigInt precision — useful for genetics (DNA sequence enumeration), cryptography key spaces, and statistical sampling.

Advertisement
After how-to · AD-W2Responsive

Combinatorics — when order matters and when it doesn't

Permutations and combinations are the two foundational counting tools of combinatorics — the mathematics of "how many ways" can you arrange or select items from a set. The distinction matters because it changes the answer by a factor of r! (r-factorial), which grows very fast. For a 6-from-49 selection: 720 (= 6!) times more permutations than combinations. The same physical scenario produces wildly different counts depending on whether your problem treats orderings as distinct or equivalent — which is why the first step in any combinatorics problem is always "does order matter?"

The mechanical recipe — and why it works

Permutation: P(n,r) = n × (n-1) × (n-2) × ... × (n-r+1). This is the count of sequences: first position has n choices, second has (n-1) remaining, third has (n-2), etc. Mathematically, this equals n! / (n-r)!. Combination: C(n,r) = P(n,r) / r! — divide permutations by r-factorial because every r-item combination corresponds to r! different orderings, all of which represent the same "combination". Both formulas extend naturally: permutations with repetition P(n,r) with replacement = n^r (PINs, license plates allow repeats); combinations with repetition use the "stars and bars" formula C(n+r-1, r). The standard formulas in this calculator assume no repetition — the most common case for lottery, poker, and committee-selection problems.

Order matters → permutation (P). Order doesn't matter → combination (C). The ratio between them is exactly r! — for 6 items, that's 720× difference between the two counts.

Why combinatorics matters for probability

Almost every probability calculation reduces to combinatorics. P(event) = (favorable outcomes) / (total outcomes), and both numerator and denominator are usually counts of combinations or permutations. Lottery odds: P(win 6/49) = 1 / C(49,6) = 1 in 13.98 million. Royal flush in 5-card poker: 4 (one per suit) / C(52,5) = 4 / 2,598,960 = 1 in 649,740. Birthday paradox: P(any 2 of 23 people share a birthday) = 1 - (365! / (365^23 × 342!)) ≈ 50.7% — a famous result that surprises everyone. Genetics: how many distinct codon arrangements in DNA = 4^n for length-n sequences. The math is the same engine across all these domains.

The ASEAN-specific lottery + statistics angle

Lottery participation is heavily regulated and culturally significant across ASEAN. Singapore Toto (6/49): 1 in C(49,6) = 1 in 13,983,816. Hong Kong Mark Six is the same 6/49 structure, so the jackpot odds are identical. Four-digit draw games — the "4D" format played widely in Malaysia and Singapore, where you pick a number from 0000 to 9999 — have exactly 10,000 possible numbers, so an exact-match bet is 1 in 10,000: vastly shorter odds than a 6-from-49 jackpot, with a correspondingly smaller prize. Bet types that cover several orderings of your digits shorten the odds further, by exactly the number of distinct permutations those digits have; the prize schedule for each bet type is set by the operator, so read the operator's own rules rather than a third-party odds table. Indonesia / Philippines / Vietnam run state lotteries with similar combinatorial structures — the format determines the odds, and C(n,r) gives them exactly. Statistical literacy across the region is improving rapidly with the rise of data-science and ML curricula at NUS / NTU / UTM / UI / KU — but lottery odds remain widely misunderstood. The calculator gives the exact denominator: the math is fixed, the marketing is the variable, and no jackpot size changes the count of possible draws.

10 Things to Know About Permutations & Combinations

01

Permutation = ORDER matters. Combination = order does NOT matter. The ratio between them is always r! (r-factorial).

02

The formulas: P(n,r) = n!/(n-r)! and C(n,r) = n!/(r!(n-r)!). C is also called the "binomial coefficient" written as (n choose r).

03

6/49 lottery odds are 1 in 13,983,816 — C(49,6). Covering every combination means buying all 13,983,816 tickets, and a shared jackpot would still split the prize.

04

A standard 52-card deck has 2,598,960 distinct 5-card hands. Only 4 are royal flushes (one per suit), giving 1-in-649,740 odds.

05

The birthday paradox: in a room of 23 people, there's a 50.7% chance two share a birthday. By 60 people, it's 99.4%. Combinatorics in action.

06

52! (the number of ways to shuffle a deck) is 80,658,175,170,943,878,571,660,636,856,403,766,975,289,505,440,883,277,824,000,000,000,000 — a 68-digit number, and this calculator prints it exactly.

07

Pascal's Triangle visualises binomial coefficients — each entry is C(n,r) where n is the row and r is the position. The triangle's rows sum to powers of 2.

08

C(n, r) = C(n, n−r) always — choosing which 6 of 49 to play is the same act as choosing which 43 to leave out, so both counts are 13,983,816.

09

0! = 1 by definition — there is exactly ONE way to arrange zero items (the empty arrangement). Mathematically required for formulas to work.

10

n choose 0 = 1 always — there's exactly one way to choose nothing. n choose n = 1 — exactly one way to choose everything.

Frequently Asked Questions

  • Permutation = ORDER matters. Combination = order does NOT matter. For 3 items A, B, C choosing 2: permutations P(3,2) = 6 (AB, BA, AC, CA, BC, CB — six distinct ordered pairs); combinations C(3,2) = 3 ({A,B}, {A,C}, {B,C} — three unordered pairs). The ratio is r! (here r=2, so 2! = 2; 6/3 = 2 ✓). Use permutation for lock combinations, race finishes, signal sequences. Use combination for lottery draws, poker hands, committee selection, ingredient mixes.

  • By mathematical convention, because there is exactly one way to arrange zero items — the empty arrangement. This isn't arbitrary; it's REQUIRED for formulas to be consistent. C(n,0) should equal 1 (one way to choose nothing); the formula n!/(0!(n-0)!) only equals 1 if 0! = 1. Similarly P(n,0) = 1 only works with 0! = 1. The gamma function (continuous extension of factorial) also gives Γ(1) = 1, supporting the definition. So 0! = 1 is not a special-case hack but a mathematical necessity.

  • Jackpot odds are one divided by the number of possible draws, so the format is the whole story. 6/49 (Singapore Toto, Hong Kong Mark Six): 1 in C(49,6) = 1 in 13,983,816. 6/45: 1 in 8,145,060. UK National Lottery (6/59): 1 in C(59,6) = 1 in 45,057,474. Games with a second barrel multiply the two counts: US Powerball (5/69 + 1 of 26) = C(69,5) × 26 = 11,238,513 × 26 = 1 in 292,201,338. Mega Millions runs a 5/70 + 1-of-24 matrix since its April 2025 relaunch, so C(70,5) × 24 = 12,103,014 × 24 = 1 in 290,472,336 — the widely quoted 1 in 302,575,350 is the older 5/70 + 1-of-25 matrix and no longer applies. Australian Powerball (7/35 + 1 of 20) = C(35,7) × 20 = 1 in 134,490,400. EuroMillions (5/50 + 2 of 12) = C(50,5) × C(12,2) = 1 in 139,838,160. Jackpot odds are not always in the millions, though: a 4-digit draw game has only 10,000 possible numbers (0000 to 9999), so an exact-match bet is 1 in 10,000 — short odds, small prize. The general rule is that shorter odds buy smaller payouts, and buying more tickets raises your chance in proportion to what you spend without changing the odds on any single ticket.

  • Yes — up to n=1000 with full BigInt precision (no floating-point rounding), and the exactness survives all the way to the screen. Up to 30 digits every digit is printed. Past that the visible line is the exact digit count plus a scientific-notation approximation read off the exact integer itself — hover the value to see the full number. 52! = 80,658,175,170,943,878,571,660,636,856,403,766,975,289,505,440,883,277,824,000,000,000,000 (68 digits). 171! has 310 digits and 1000! has 2,568 — all computed exactly. For n above 1000, computation is skipped for browser performance safety — most real-world combinatorics fits well within this limit. If you need to compute n! for n > 1000 (unusual), the result has thousands of digits — use scientific notation approximations via Stirling's formula instead.

  • The standard formulas in this calculator assume NO repetition — each item can be selected at most once. For combinations WITH repetition (e.g. "how many 3-scoop ice cream cones can I make from 10 flavors, allowing repeats?"), use C(n+r-1, r). For 3 scoops from 10 flavors with repetition: C(12, 3) = 220. For permutations WITH repetition (e.g. 4-digit PIN with digits 0-9 allowing repeats): use n^r = 10^4 = 10,000. Compute these manually by entering the modified n and r into the no-repetition formula.

  • Probability = (favorable outcomes) / (total outcomes), where both numerator and denominator are counted using combinations or permutations as appropriate. Examples: P(royal flush in 5-card poker) = (4 royal flushes possible) / (C(52,5) total hands) = 4 / 2,598,960 = 1/649,740. P(exactly 3 of 6 lottery numbers match the 6 winning) = C(6,3) × C(43,3) / C(49,6) = 20 × 12,341 / 13,983,816 ≈ 1/57. The pattern is always: count favorable (using C/P), count total (using C/P), divide.

  • Pascal's Triangle is a triangular array where row n contains the binomial coefficients C(n,0), C(n,1), ..., C(n,n). Each entry equals the sum of the two entries directly above it. Row 0: 1. Row 1: 1, 1. Row 2: 1, 2, 1. Row 3: 1, 3, 3, 1. Row 4: 1, 4, 6, 4, 1. Row 5: 1, 5, 10, 10, 5, 1. Each row sums to 2^n. The triangle visualises combinatorial identities and is the visual heart of binomial expansion — (a+b)^n's coefficients come straight from row n. Named after French mathematician Blaise Pascal but actually discovered much earlier in China (Yang Hui), India (Pingala), and Persia (Al-Karaji) — independent re-discoveries over centuries.

  • It's the foundation of: probability theory (counting outcomes), cryptography (counting key spaces — how hard is it to brute-force a 128-bit key? 2^128 = 3.4×10^38 attempts), genetics (DNA sequence enumeration, recombination math), machine learning (sampling strategies, feature combinations), statistics (binomial + multinomial distributions), computer science (algorithm analysis, hash table sizing), game theory (strategy enumeration). The same n choose r formula that tells you lottery odds also tells you how many distinct 10-feature subsets you can extract from a 100-feature dataset for ML model selection: C(100, 10) ≈ 1.7×10^13 — too many to exhaustively try, which is why feature selection algorithms exist.

  • No. All calculations run entirely in your browser via JavaScript using BigInt for precision. There's no server roundtrip — open DevTools → Network and confirm zero outbound requests. Your inputs stay on your device. Safe for cryptographic key-space analysis, sensitive research, or any combinatorics work that shouldn't leave your machine.

  • Many real problems have multiple combinatorial steps. Example: "How many ways to choose a 4-person committee from 10 people, then designate one as chair?" Step 1: choose 4 unordered = C(10,4) = 210. Step 2: pick chair from the 4 = 4 ways. Total = 210 × 4 = 840. Equivalently: P(10,1) × C(9,3) = 10 × 84 = 840 (pick chair first, then 3 others). Multi-step problems break down into a product of permutations and combinations at each step. The calculator computes one step at a time; chain results manually for compound problems.

Advertisement
Pre-footer · AD-W3 728 × 90