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 · Converters & Units

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): odds 1 in 13,983,816 — same as classic 6/49. Group I (jackpot) sum starting from S$1M. Malaysia Magnum 4D (4-digit lottery): permutation-based 10,000 numbers, ~1 in 1,500 for "iBox" (all permutations of your number), 1 in 10,000 for direct. Thailand National Lottery: 6-digit selection, odds depend on which prize tier. Indonesia / Philippines / Vietnam: state-run lotteries with similar combinatorial structures. Hong Kong Mark Six: 6/49 format, identical odds to Singapore Toto. 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 exact odds — the math is fixed, the marketing is the variable. A "trillion-to-one" jackpot is mathematically near-impossible regardless of how many tickets you buy.

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. Buying every possible ticket would cost ~$28M for a guaranteed $1M+ jackpot — and someone else would likely win simultaneously.

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 roughly 8 × 10^67 — more than there are atoms in the observable solar system.

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

The "!" symbol for factorial was introduced by French mathematician Christian Kramp in 1808. Before that, mathematicians wrote out the full multiplication.

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.

  • 6/49 format (Singapore Toto, Hong Kong Mark Six): 1 in C(49,6) = 1 in 13,983,816. 6/45: 1 in 8,145,060. Powerball (US, 5/69 + 1/26): 1 in 292,201,338. Mega Millions (US, 5/70 + 1/25): 1 in 302,575,350. Australian Powerball (7/35 + 1/20): 1 in 134,490,400. Euro-Millions (5/50 + 2/12): 1 in 139,838,160. UK National Lottery (6/59): 1 in 45,057,474. The math is unforgiving — no lottery system has odds better than 1 in 8 million for the jackpot. Buying more tickets linearly increases your odds but the cost grows linearly too.

  • Yes — up to n=1000 with full BigInt precision (no floating-point rounding). For results that have more than 30 digits, the calculator shows the digit count + scientific notation approximation. 52! = ~8×10^67, easily handled. 100! = ~9.3×10^157, also fine. 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.

Related News

You may be interested in these recent stories from our newsroom.

No related news yet for this tool. Our editorial team publishes new pieces every week.

Browse all news →
Advertisement
Pre-footer · AD-W3 728 × 90

75 more free tools

Calculators, converters, security tools — no signup.