A permutation and combination calculator that turns two numbers — n (how many
items you have) and r (how many you pick) — into both nPr and nCr, then shows
the full factorial working behind each answer. It is built for students learning
counting principles, teachers checking answers, and anyone working with probability,
lottery odds, card hands, or experiment design.
How it works
Counting problems split into two families. When order matters you want a permutation: lining up 3 runners from 10 onto a podium, or generating a 4-digit PIN. The formula is:
nPr = n! ⁄ (n − r)!
When order does not matter you want a combination: dealing a 5-card poker hand, or picking a 6-number lottery ticket. The formula is:
nCr = n! ⁄ (r! · (n − r)!)
The two are linked by a single fact: every unordered group of r items can be arranged in
r! different orders, so nPr = nCr × r!. The calculator computes both directly and
displays the substituted formula plus each factorial term, so you can follow the
arithmetic rather than just trust a number.
Crucially, all maths runs with BigInt. Factorials explode fast — 13! already passes
six billion and 21! exceeds the largest integer a normal double can hold exactly. Where
ordinary calculators silently round, this tool keeps every digit precise, so 52C5 (the
number of distinct poker hands) returns exactly 2,598,960 and far larger inputs stay
correct to the last digit.
Worked example
How many ways can a club of 10 members fill the roles of president, secretary and treasurer (order matters), versus simply pick a committee of 3 (order ignored)?
- Permutations:
10P3 = 10! / (10 − 3)! = 10! / 7! = 10 × 9 × 8 = 720 - Combinations:
10C3 = 10! / (3! · 7!) = 720 / 6 = 120
So there are 720 ordered office assignments but only 120 distinct committees — and
indeed 720 = 120 × 3!, confirming the relationship between the two counts.
| n | r | nPr (ordered) | nCr (unordered) |
|---|---|---|---|
| 5 | 2 | 20 | 10 |
| 10 | 3 | 720 | 120 |
| 52 | 5 | 311,875,200 | 2,598,960 |
| 49 | 6 | 10,068,347,520 | 13,983,816 |
Formula note
Both formulas rely on the factorial k! = k × (k−1) × … × 2 × 1, with the convention
0! = 1. The combination nCr is also the binomial coefficient that appears in
Pascal’s triangle and the expansion of (a + b)ⁿ, where it gives the coefficient of the
term aⁿ⁻ʳ bʳ. To avoid building giant intermediate factorials, the tool computes nCr
multiplicatively using the smaller of r and n − r, which keeps results exact and fast.
Inputs must satisfy 0 ≤ r ≤ n with whole numbers; n is capped at 1000 purely to keep
the display responsive.
Every figure is calculated in your browser — no numbers are uploaded or stored.