Permutation & Combination Calculator: nPr, nCr, and Exact BigInt Results
Calculate permutations (nPr) and combinations (nCr) with or without repetition. Get exact BigInt answers, the formula used, and worked examples — all in your browser.
Table of Contents
A spreadsheet FACT() call looks fine until n hits the teens. JavaScript Number overflows a factorial around n = 18. After that you get Infinity, scientific notation that silently rounded, or a probability that is off by a few tickets. That is the wrong place to discover you mixed up “order matters” with “order does not.”
The Permutation & Combination Calculator computes P(n, r) and C(n, r) with or without repetition, using arbitrary-precision BigInt arithmetic. You see the formula, the substitution, and a thousands-separated integer — not a float that rounded away the last digits. Nothing is uploaded.
This guide covers the four modes, when r cannot exceed n, why lottery tickets are combinations and PIN codes are permutations, and how to read the result next to a probability or a random draw.
Why Use a Permutation & Combination Calculator?
Hand formulas fail at the same three points: mixing P with C, forgetting repetition, and overflowing the factorial.
- Exact integers, not scientific notation. BigInt keeps every digit. C(49, 6) is 13,983,816, not 1.398e7.
- All four textbook cases in one place. Permutation or combination, each with or without repetition. No hunting for a second “stars and bars” page.
- The formula is visible. The tool prints P(n, r) = n! / (n − r)! or n^r or C(n+r−1, r) with your numbers filled in, so you can check the mode before you trust the count.
- Private by design. Inputs stay in the tab. Useful when the numbers sit next to an exam, a hiring puzzle, or an unpublished product spec.
- Copy or download. Paste the integer into notes, or download JSON with mode, n, r, formula, and value.
- Locale thousands separators. Large combinatoric counts stay readable (13,983,816 rather than a 8-digit blob).
Key Features
| Feature | What it does |
|---|---|
| Permutation (nPr) | Ordered arrangements. Gold / silver / bronze is a permutation. |
| Combination (nCr) | Unordered selections. A lottery ticket is a combination. |
| Repetition toggle | Without: each item used at most once. With: items may repeat (n^r, multisets). |
| Exact BigInt math | Falling factorials and binomial coefficients stay integers up to n, r ≤ 5000. |
| Formula + working | Shows the identity and the substituted values next to the result. |
| Copy / JSON download | Copy the formatted integer or save { mode, n, r, formula, value }. |
n is the size of the pool. r is how many you pick or arrange. Both must be non-negative integers. Without repetition, r cannot exceed n — you cannot award five distinct medals from three athletes. With repetition, r may be larger than n (a 6-digit PIN from 10 digits).
The engine uses a falling product for permutations (n × (n−1) × …) and a reduced binomial product for combinations (multiply k terms, divide by k!, with k = min(r, n−r)). That avoids building full n! in memory. The hard cap of 5000 is a performance guard, not a math limit.
How to Use
- Pick the mode. Choose Permutation (nPr) if the sequence of picks matters. Choose Combination (nCr) if {1, 2, 3} is the same ticket as {3, 2, 1}.
- Set repetition. Without repetition is the default classroom case. Switch to with repetition for PINs, scoops that can match, or any “replace after draw” model.
- Enter n and r. Integers only. Example: eight runners, three podium places → n = 8, r = 3.
- Read the formula row, then the result. Confirm the identity matches the story you meant (P(8, 3) = 8! / 5! versus C(8, 3)). The explanation line restates the count in words.
- Copy or download. Use Copy for a single integer. Use Download when you want the mode and formula attached for a homework appendix or a design note.
Reset returns to permutation, without repetition, and empty fields.
Understanding Permutations vs Combinations
Permutation means order is part of the outcome. Seating three guests around labeled chairs, awarding ranked prizes, or writing a password of distinct characters are permutations. The formula without repetition is
P(n, r) = n! / (n − r)!
which is just the falling factorial: first pick n choices, then n−1, down to r factors. With repetition it collapses to n^r — each of the r slots independently chooses from n symbols.
Combination means only the set matters. A 6-number lottery line, a committee of four from a class of 30, or a dealt poker hand are combinations. Without repetition:
C(n, r) = n! / (r! × (n − r)!)
The extra r! in the denominator removes the r! ways to order the same set. With repetition you are counting multisets (stars and bars):
C(n + r − 1, r)
Five ice-cream flavors, three scoops, repeats allowed: C(5+3−1, 3) = 35.
A common trap: calling a 4-digit PIN a “combination lock.” If 0000 is allowed and 1234 differs from 4321, that is P(10, 4) with repetition = 10,000, not C(10, 4). Another trap: using n! when you only need P(n, r). Full factorial is the special case r = n.
Why BigInt: C(100, 50) is a 30-digit integer. IEEE-754 doubles have 53 bits of significand — they cannot store that value exactly. The calculator never converts the count to Number for the arithmetic, only for display grouping.
Practical Use Cases
Race podium and ranked prizes
Eight athletes, medals for first, second, and third. Order matters and nobody gets two medals: permutation without repetition. P(8, 3) = 8 × 7 × 6 = 336. If the meet only published an unordered “top three” list, that would be C(8, 3) = 56 — a different question, and a different prize ceremony.
Lottery tickets and jackpot odds
A 6-from-49 draw treats {7, 12, 19, 23, 31, 44} as one ticket. That is C(49, 6) = 13,983,816. Your chance of matching all six (one ticket, fair draw) is 1 / 13,983,816. Pair the count with a Probability Calculator if you need “at least 3 matches” rather than the raw ticket space. To sample a line instead of counting them, use the Lottery Number Generator.
PIN codes and lock keyspaces
Four digits, 0–9, repeats allowed: P(10, 4) with repetition = 10^4 = 10,000. Four distinct digits: P(10, 4) without repetition = 10 × 9 × 8 × 7 = 5,040. If you are sizing a short code for a product, the repetition toggle is the difference between “all numeric PINs” and “no repeated digit.”
Ice cream, toppings, and other multisets
Five flavors, three scoops, doubles allowed, order at the window ignored: combination with repetition, C(5+3−1, 3) = 35. Same math covers “buy 4 donuts from 6 kinds” or “distribute identical stickers into 5 folders.” If the shop plates scoops in a stack (top flavor visible), switch to permutation with repetition — 5^3 = 125 — because the stack order is now part of the order.
Best Practices
- Name the story before you pick the mode. Write “ranked” or “unordered set” in the same sentence as n and r. Mode errors dwarf arithmetic errors.
- Check repetition against replacement. Drawing cards without putting them back is “without.” Choosing letters for a license plate that may repeat is “with.”
- Reject r > n unless repetition is on. The tool blocks the without-repetition case. If you hit that error, you either need repetition or a smaller r.
- Stay at or under 5000. The cap keeps the tab responsive. Counts above that belong in a CAS or a dedicated BigInt script, not a UI loop.
- Copy the formatted result; do not retype 8-digit integers. A missed comma in a slide is how 13,983,816 becomes 1,398,381.
- Do not treat the count as a probability. The calculator returns how many outcomes exist. Divide by the size of the sample space yourself, or use a probability tool for compound events.
Ready to count the arrangements? Open the Permutation & Combination Calculator, pick nPr or nCr, set repetition, and read the exact integer.
Related Tools You Might Like:
- Lottery Number Generator — draw a random ticket after you know how large the ticket space is.
- Scientific Calculator — factorials, powers, and general arithmetic when you are not in a combinatorics mode.
- Probability Calculator — turn a combination count into “at least k” or independent-event odds.
Happy counting.