Skip to content

Combination and Permutation Calculator (nCr, nPr)

Exact nCr and nPr, with or without repetition, for n up to 10,000 — plus a row of Pascal’s triangle.

Your details

Order matters?

Results update as you type

Number of ways

120

Number of digits
3
Permutations P(n, r)
720
Combinations with repetition
220
Permutations with repetition nʳ
1,000
Row n of Pascal’s triangle
1, 10, 45, 120, 210, 252, 210, 120, 45, 10, 1

Step-by-step solution
  1. C(n, r) = n! / (r! × (n − r)!) = 10! / (3! × 7!)
  2. = (10 × 9 × 8) / (3 × 2 × 1) = 720 / 6 = 120

How many different lottery tickets are there? How many ways can eight runners fill a podium? How many four-digit PIN codes exist? All of these are counting questions, and they come down to two choices: does the order matter, and can an item be picked more than once?

This calculator answers all four cases at once:

Order does not matter Order matters
No repetition combinations C(n,r)C(n, r) permutations P(n,r)P(n, r)
Repetition allowed multisets C(n+r−1,r)C(n + r - 1, r) sequences nrn^r

Enter the number of available items nn and the number you pick rr. The headline shows the case you selected; the three other counts are listed underneath so you can compare them. Results are exact integers computed with arbitrary-precision arithmetic — even C(10 000,5 000)C(10\,000, 5\,000), which has 3,009 digits, is given digit by digit in a table. For n≤20n \le 20 the calculator also prints the matching row of Pascal’s triangle.

The number C(n,r)C(n, r) is also called the binomial coefficient and read "n choose r"; it is the coefficient of xrx^r in the expansion of (1+x)n(1 + x)^n, which is why it appears in the binomial probability distribution.

How to use this calculator

  1. Choose whether order matters: No for groups, hands, committees or lottery draws; Yes for rankings, codes and arrangements.
  2. Switch on repetition if the same item can be chosen again (digits of a PIN, scoops of the same flavour).
  3. Enter n, the number of items available, and r, how many you pick (both whole numbers up to 10,000).
  4. Read the count, its number of digits and the other three variants. Open the steps for the formula with your numbers.

The formula

With nn items and rr picks:

C(n,r)=(nr)=n!r! (n−r)!P(n,r)=n!(n−r)!C(n, r) = \binom{n}{r} = \frac{n!}{r!\,(n - r)!} \qquad P(n, r) = \frac{n!}{(n - r)!}
with repetition:(n+r−1r)andnr\text{with repetition:}\quad \binom{n + r - 1}{r} \quad\text{and}\quad n^r

Permutations and combinations are linked by P(n,r)=r!⋅C(n,r)P(n, r) = r! \cdot C(n, r): each unordered group of rr items can be ordered in r!r! ways. When r>nr > n and repetition is not allowed, both counts are 0.

Rather than computing huge factorials, the calculator uses the multiplicative form (nr)=∏i=1rn−r+ii\binom{n}{r} = \prod_{i=1}^{r} \frac{n - r + i}{i}, in which every intermediate value is an integer (Knuth, The Art of Computer Programming, vol. 1, §1.2.6). Pascal’s rule (nr)=(n−1r−1)+(n−1r)\binom{n}{r} = \binom{n-1}{r-1} + \binom{n-1}{r} builds the triangle row by row.

Worked example

  • Lottery, 6 numbers out of 49 (order irrelevant, no repetition): C(49,6)=13,983,816C(49, 6) = 13,983,816 possible tickets.
  • Poker hands: C(52,5)=2,598,960C(52, 5) = 2,598,960.
  • Podium, 8 runners (gold, silver, bronze): P(8,3)=8×7×6=336P(8, 3) = 8 \times 7 \times 6 = 336.
  • 3 scoops from 5 flavours, the same flavour allowed twice: C(5+3−1,3)=C(7,3)=35C(5 + 3 - 1, 3) = C(7, 3) = 35.
  • 4-digit PIN codes: 104=10,00010^4 = 10,000.
  • Choosing 50 out of 100: C(100,50)C(100, 50) = 100,891,344,545,564,193,334,812,497,256, a 30-digit number the calculator still prints in full.

Binomial coefficients and Pascal’s triangle

Each number in Pascal’s triangle is the sum of the two above it, and row nn lists (n0),(n1),…,(nn)\binom{n}{0}, \binom{n}{1}, \dots, \binom{n}{n}. Row 4 is 1, 4, 6, 4, 1, which gives (a+b)4=a4+4a3b+6a2b2+4ab3+b4(a + b)^4 = a^4 + 4a^3b + 6a^2b^2 + 4ab^3 + b^4. The entries of a row add up to 2n2^n — the number of subsets of a set of nn items — and the triangle is symmetric because (nr)=(nn−r)\binom{n}{r} = \binom{n}{n-r}: choosing who is in is the same as choosing who is out.

Combinations in probability

Counting is the first step in many probability questions: the chance of winning the 6/49 lottery with one ticket is 1/13,983,8161 / 13,983,816. The binomial distribution, P(X=k)=(nk)pk(1−p)n−kP(X = k) = \binom{n}{k} p^k (1 - p)^{n - k}, uses the binomial coefficient to count the orders in which kk successes can occur. To describe a set of measured values rather than count arrangements, see the standard deviation calculator.

Frequently asked questions

What is the difference between a combination and a permutation?

A combination is a selection where order does not matter (a hand of cards); a permutation is an arrangement where it does (a race podium). There are always at least as many permutations as combinations: P(n, r) = r! × C(n, r).

What does "n choose r" mean?

It is the binomial coefficient C(n, r): the number of ways to choose r items out of n when order does not matter. For example, 5 choose 2 is 10.

What happens if r is larger than n?

Without repetition there is no way to pick more items than exist, so the count is 0. With repetition allowed, r can be larger than n: three scoops from two flavours gives C(4, 3) = 4 options.

Why is C(n, 0) equal to 1?

There is exactly one way to choose nothing: the empty selection. Likewise 0! = 1 by convention, which keeps the formula consistent.

How large can n be?

Up to 10,000. The result is computed exactly; when it has more than 30 digits, the headline shows scientific notation and a table lists every digit.

Sources

Last updated:

More Statistics calculators

People also use