Tools · Math & Statistics

Permutation and Combination Calculator

Order matters for a permutation and does not for a combination — that is the whole distinction, and it changes the answer by a factor of r!. Enter how many items there are and how many you are picking to get both counts exactly, along with the two versions that allow repeats.

Exact integers, however many digits that takesHow it worksInputs stay on this device
Your inputs

Pick r from n

How many distinct things are available — runners in the race, balls in the machine, letters in the alphabet you are drawing from.

How many are taken. For the two no-repeat counts this cannot exceed n — there is no way to pick five distinct items from three.

Your inputs are calculated locally and are not stored.
Permutations — 10 P 3720

Ordered arrangements of 3 taken from 10 — first, second and third are a different podium from third, second and first. If the order does not matter, there are 120 selections instead, because every one of them can be arranged in 6 ways.

Combinations — 10 C 3
120
Orderings per selection (r!)
6
Digits in the permutation count
3
Permutations as a decimal
720
Combinations as a decimal
120
All four ways to pick 3 from 10 — order counted or not, repeats allowed or not
ArrangementFormulaExact countDigits
Permutations — order matters, no repeatsn! ÷ (n − r)!7203
Combinations — order ignored, no repeatsn! ÷ (r! (n − r)!)1203
Permutations with repetition1,0004
Combinations with repetition(n + r − 1)! ÷ (r! (n − 1)!)2203
Formula & methodology

Two questions, four formulas

Does the order count? Can an item be picked twice? Answer both and exactly one of these four applies.

nPr = n! ÷ (n − r)!  •  nCr = n! ÷ (r! (n − r)!)  •  nʳ  •  C(n + r − 1, r)
n
How many distinct items there are to pick from
r
How many of them are picked
nPr
Arrangements — order counts, no item picked twice
nCr
Selections — order ignored, no item picked twice
Arrangements with repetition — a four-digit PIN, where every position is free
C(n + r − 1, r)
Selections with repetition — three scoops from ten flavours, where two can match

Why nCr is nPr divided by r!

Count the arrangements first: n choices for the first pick, n − 1 for the second, and so on for r picks. That is nPr. Now notice that every group of r items has been counted once for each order it could appear in, and there are r! such orders. Dividing by r! collapses them into one, which is precisely what ignoring order means. The division is always exact, because r! divides any r consecutive integers.

Why the answers are computed as whole numbers, not decimals

These counts outrun ordinary floating-point arithmetic almost immediately. A JavaScript number — the same double a spreadsheet uses — holds integers exactly only up to 9,007,199,254,740,991. 21! is already past that, and by 171! the value overflows to infinity. The result is a figure that looks authoritative while being wrong in its last digits, or missing entirely. Every count here is computed in arbitrary-precision integer arithmetic and returned as exact digits; the decimal approximation shown alongside is labelled as one.

Why nPr is not evaluated literally as n! ÷ (n − r)!

Written out, 1000P3 would build a 2,568-digit factorial and a 2,566-digit one only to divide almost all of it away again. The falling factorial n(n − 1)…(n − r + 1) is the same value in three multiplications rather than two thousand, and nCr follows from it with a single exact division.

Worked example

Six numbers from forty-nine

A lottery draws six balls from forty-nine and the order they come out in does not matter. How many tickets are there?

Start by pretending order does matter. The first ball can be any of 49, the second any of the remaining 48, and so on: 49 × 48 × 47 × 46 × 45 × 44 = 10,068,347,520. That is 49P6, and it is ten billion — far too many, because it has counted every ticket once for each order its six numbers could have appeared in.

Six numbers can be arranged in 6! = 6 × 5 × 4 × 3 × 2 × 1 = 720 orders. So divide: 10,068,347,520 ÷ 720 = 13,983,816. That is 49C6, and it is the number of distinct tickets — a shade under fourteen million, which is where the familiar one-in-fourteen-million figure comes from.

The repetition variants answer different games. If the same ball could be drawn six times and order still counted, there would be 49⁶ = 13,841,287,201 outcomes. If it could be drawn repeatedly but order did not count, there would be C(54, 6) = 25,827,165 — nearly twice as many tickets as the real game, because 44-44-44-44-44-44 becomes a ticket you can buy.

The default above, 3 from 10, works the same way at a readable scale: 720 podiums, 120 committees, 1,000 three-digit codes, and 220 ways to take three scoops from ten flavours.

Assumptions

What this calculator assumes

  • All n items are distinguishable. Counting arrangements of the letters in a word with repeated letters is a different formula — n! divided by the factorial of each repeat count — and is not what this tool computes.
  • Every pick is from the same pool. Multi-stage problems, where the second choice comes from a different set than the first, have to be broken into steps and multiplied.
  • r may not exceed n. The two no-repeat counts would be zero, and a table where half the cells are zero is a table that invites misreading.
  • n is capped at 1,000. That is already far past useful: 1000! has 2,568 digits and 1000¹⁰⁰⁰ has 3,001.
  • Counts are exact integers. The decimal approximation beside them is a convenience for judging scale and is explicitly marked unavailable once the value passes what a double can hold.
  • Arrangements are counted, not listed. There is no enumeration of the 13,983,816 tickets, for reasons that should be obvious from the number.
Common questions

Permutations and combinations FAQ

What is the difference between a permutation and a combination?

Whether order counts. A permutation counts arrangements, so gold-silver-bronze is a different result from bronze-silver-gold. A combination counts selections, so a lottery ticket with the same six numbers is the same ticket whatever order the balls came out in. The two are related by a single factor: nPr = nCr × r!, because every selection of r items can be arranged in r! different orders.

How many combinations are there in a 6-from-49 lottery?

13,983,816. There are 49 × 48 × 47 × 46 × 45 × 44 = 10,068,347,520 ways to draw six balls in order, and each ticket corresponds to 6! = 720 of those orders, so dividing gives 13,983,816 distinct tickets. That is why a single ticket has roughly a one in fourteen million chance of matching all six.

What do nPr and nCr mean on a calculator?

nPr is the number of permutations of r items taken from n, computed as n! ÷ (n − r)!. nCr is the number of combinations, computed as n! ÷ (r! (n − r)!). They are also written P(n, r) and C(n, r), and nCr is frequently written as the binomial coefficient, read as n choose r. The two buttons are next to each other on most scientific calculators, which is how people end up pressing the wrong one.

Why does this show four numbers instead of one?

Because how many ways is ambiguous until two more questions are answered: does order matter, and can an item be picked more than once. Those two questions give four different counts, and picking three from ten gives 720, 120, 1,000 and 220 depending on the answers. Showing one of them alone would silently resolve an ambiguity that belongs to you, not to the calculator.

Why does a big answer appear as 4.0238 × 10^2567?

Because the exact figure has 2,568 digits, which is not something a headline can carry. The exact digits are still there, in full, in the table below the result — nothing is rounded away. Only the summary line switches to scientific notation, and it does so above 21 digits.

Why can I not pick more items than there are?

Because for the two no-repeat counts there is no way to do it: there are zero ways to choose five distinct items from three. The repetition counts are still perfectly well defined when r is larger than n, but a result table with two zeroes and two large numbers invites the large ones to be read as the answer to the question you asked. The calculator refuses instead, and says why.

Primary sources

Sources and review notes

  1. NIST Digital Library of Mathematical Functions §26.3 — the reference definition of the binomial coefficient and its identities
  2. NIST DLMF §5.2 — the factorial and gamma function, which is where n! is formally defined
  3. OEIS A000142 — the factorials, useful for checking a long answer digit by digit
  4. ECMA-262, BigInt objects — the arbitrary-precision integer type this calculator computes in

These counts are exact and definitional; there is no data behind them to go stale. The sources are cited for the standard statements of the formulas and for the integer arithmetic the results depend on.