Statistics & Probability

Permutation and Combination Calculator

This permutation calculator finds nPr, the number of ordered arrangements P(n,r)=n!(n−r)!P(n, r) = \frac{n!}{(n - r)!}, and works as an nCr calculator for unordered selections (nr)=n!r!(n−r)!\binom{n}{r} = \frac{n!}{r!\,(n - r)!}.

Try

A whole number from 0 to 1,000,000,000.

How many items are picked or arranged.

All five counts are always listed; this one is shown first.

More options Identical items (group sizes)

To arrange all n items when some are identical, list the size of each group. MISSISSIPPI is n = 11 with 4, 4, 2, 1. Unlisted items count as distinct.

Result

Permutations P(10, 3): 720

Permutations P(10, 3)

720

Exact value

Permutations P(10, 3)Order matters, no repeats
720
Combinations C(10, 3)Order does not matter, no repeats
120
Circular arrangements P(10, 3) ÷ 3Seats in a circle, rotations count once
240
Combinations with repetition C(10 + 3 − 1, 3)Order does not matter, repeats allowed
220
Permutations with repetition 10³Order matters, repeats allowed
1,000
Number of digits
3
Scientific notation
7.2×10²

There are 720 ways to arrange 3 of 10 items when order matters (permutations) and 120 ways to choose them when it does not (combinations), because each group of 3 can be put in 3! different orders.

P(10, r) and C(10, r) for every r from 0 to 10
rPermutations P(n, r)Combinations C(n, r)
011
11010
29045
3720120
45,040210
530,240252
6151,200210
7604,800120
81,814,40045
93,628,80010
103,628,8001
Step-by-step working (5 steps)
  1. Permutations (order matters)

    Multiply the 3 largest whole numbers from 10 downward.

    P(10,3)=10!(7)!=10⋅9⋅8=720P(10, 3) = \frac{10!}{(7)!} = 10 \cdot 9 \cdot 8 = 720
  2. Combinations (order does not matter)

    Divide the ordered arrangements by the r! orders of each group.

    (103)=10!3!(7)!=10⋅9⋅83⋅2⋅1=120\binom{10}{3} = \frac{10!}{3!\,(7)!} = \frac{10 \cdot 9 \cdot 8}{3 \cdot 2 \cdot 1} = 120
  3. Circular arrangements

    Turning a circle of 3 seats gives 3 rotations of the same arrangement, so divide P(10, 3) by 3.

    P(10,3)3=240\frac{P(10, 3)}{3} = 240
  4. Combinations with repetition

    Count the ways to place r identical stars among n − 1 bars (stars and bars).

    (n+r−1r)=(123)=220\binom{n + r - 1}{r} = \binom{12}{3} = 220
  5. Permutations with repetition

    Each of the 3 positions can be any of the 10 items.

    nr=103=1000n^r = 10^{3} = 1000

It also counts circular arrangements and both cases with repetition, shows the steps, and keeps every digit of huge results.

By Hira Noor, mathematicianLast reviewed Free, no sign-up, runs in your browserReport a problem

How to use this calculator

  1. Enter n, the number of distinct items available, and r, how many you pick or arrange. Both are whole numbers from 0 to 1,000,000,000.
  2. Decide whether order matters. A race result, a password or a seating plan is a permutation; a lottery ticket or a committee is a combination.
  3. Decide whether an item can be used more than once. PIN digits and ice-cream scoops can repeat; lottery balls and people cannot.
  4. Pick the matching main result. All five counts are listed anyway, with the working for each. For small cases (up to 120 results) every selection or arrangement of 1 to n is written out, and for n up to 20 a table gives P(n, r) and C(n, r) for every r.
  5. To arrange items where some are identical, such as the letters of a word, open More options and enter the group sizes.

Formulas

Permutations (nPr)

P(n,r)=n!(n−r)!=n(n−1)⋯(n−r+1)P(n, r) = \frac{n!}{(n - r)!} = n(n - 1)\cdots(n - r + 1)

Plain-text formula: P(n, r) = (n!)/((n − r)!) = n(n − 1)⋯(n − r + 1)

Ordered arrangements of r different items from n. The calculator multiplies the r factors with exact integer (BigInt) arithmetic, so the result is never rounded.

Combinations (nCr)

(nr)=n!r!(n−r)!=P(n,r)r!\binom{n}{r} = \frac{n!}{r!\,(n - r)!} = \frac{P(n, r)}{r!}

Plain-text formula: (C(n, r)) = (n!)/(r! (n − r)!) = (P(n, r))/(r!)

Unordered selections of r different items from n. Every combination corresponds to r! permutations, so dividing P(n, r) by r! removes the orderings.

Circular arrangements

P(n,r)r,(n−1)!;when r=n\frac{P(n, r)}{r}, \qquad (n - 1)! ;\text{when } r = n

Plain-text formula: (P(n, r))/r, (n − 1)!;when r = n

Seats around a round table have no first seat, so the r rotations of one seating count once.

With repetition

nr;(ordered),(n+r−1r);(unordered)n^r ;\text{(ordered)}, \qquad \binom{n + r - 1}{r} ;\text{(unordered)}

Plain-text formula: n^r;(ordered), (C(n + r − 1, r));(unordered)

If items can be reused, ordered sequences have n choices for each of the r positions, and unordered selections are counted by "stars and bars".

Reading the result

The answer counts outcomes, not probabilities. To get the chance of one particular outcome when all are equally likely, divide 1 by the count: one lottery ticket out of 13,983,816 has a probability of about 7.15 × 10⁻⁸. To draw a set of numbers without repeats, use the random number generator.

Choosing the wrong formula is the most common mistake. Ask two questions: does the order of the chosen items create a different outcome, and can the same item appear twice? The table under "Which formula should I use?" maps each answer to its count.

Counts grow very fast. C(1000, 500) already has 300 digits; the calculator writes out every digit up to 5,000 digits and gives scientific notation beyond that.

Which formula should I use?

Order matters when rearranging the same items gives a different result. Gold, silver and bronze for runners A, B and C is a different podium from C, B, A, so podiums are permutations: P(8, 3) = 8 × 7 × 6 = 336 for eight runners.

Order does not matter when only membership counts. A committee of A, B and C is the same committee as C, B, A, so committees are combinations: C(8, 3) = 56. Dividing 336 by the 3! = 6 orderings of each group gives the same 56.

Which count applies, with n = 8 items and r = 3 chosen where it applies
SituationOrder matters?Repeats?FormulaExample
Permutation (nPr)YesNon!/(n − r)!Podium of 3 from 8 runners: 336
Combination (nCr)NoNon!/(r!(n − r)!)Committee of 3 from 8 people: 56
Circular arrangementYes, up to rotationNoP(n, r)/r8 guests at a round table: 7! = 5,040
Permutation with repetitionYesYesnʳ3-letter codes from 8 letters: 512
Combination with repetitionNoYes(n + r − 1)!/(r!(n − 1)!)3 scoops from 8 flavors: 120
Arrangement with identical itemsYesSome items identicaln!/(k₁! · k₂! · …)Letters of MISSISSIPPI: 34,650

How to calculate combinations and permutations by hand

Permutations (nPr): start at n and multiply r numbers, counting down by 1. For 5P2, multiply 5 × 4 = 20. You never need the full factorials, because (n − r)! cancels.

Combinations (nCr): work out nPr, then divide by r!. For 5C2, 20 ÷ 2! = 10, so there are 10 ways to pick 2 items from 5. If r is more than half of n, use n − r instead: C(10, 8) = C(10, 2) = 45.

Items that repeat inside the list: to arrange letters or objects where some are identical, divide n! by the factorial of each group size. MISSISSIPPI has 11 letters (4 I, 4 S, 2 P, 1 M), so it has 11!/(4! · 4! · 2! · 1!) = 34,650 distinct arrangements. Enter n = 11 and the group sizes 4, 4, 2, 1 under More options to see the working.

Common nPr and nCr values
nnP2nC2nP3nC3nP5nC5
5201060101201
63015120207206
85628336566,72056
10904572012030,240252
12132661,32022095,040792
203801906,8401,1401,860,48015,504
522,6521,326132,60022,100311,875,2002,598,960

nPr and nCr on a calculator, in Excel and in Python

TI-84 Plus: type n, press MATH, move right to PRB, choose 2:nPr or 3:nCr, then type r and press ENTER. Casio fx-991EX and similar models: type n, press SHIFT then × for nPr or SHIFT then ÷ for nCr, then type r.

Excel and Google Sheets: =PERMUT(n, r) gives nPr, =COMBIN(n, r) gives nCr, =PERMUTATIONA(n, r) gives nʳ and =COMBINA(n, r) gives combinations with repetition. Spreadsheets use floating-point numbers, so results above about 15 significant digits are rounded.

Python 3.8 and later: math.perm(n, r) and math.comb(n, r) return exact integers of any size, the same values this calculator shows.

Worked example

Lottery: 6 numbers from 49

How many different tickets are there when 6 numbers are drawn from 1 to 49 and the order of the draw does not matter?

  1. Order does not matter and a number cannot be drawn twice, so use combinations with n = 49 and r = 6.
  2. (496)=49⋅48⋅47⋅46⋅45⋅446⋅5⋅4⋅3⋅2⋅1\binom{49}{6} = \frac{49 \cdot 48 \cdot 47 \cdot 46 \cdot 45 \cdot 44}{6 \cdot 5 \cdot 4 \cdot 3 \cdot 2 \cdot 1}.
  3. The numerator is P(49, 6) = 10,068,347,520 and the denominator is 6! = 720.
  4. Dividing gives 13,983,816.

Answer: There are 13,983,816 possible tickets, so a single ticket wins with probability 1 in 13,983,816 (about 7.15 × 10⁻⁸). If the order mattered, there would be P(49, 6) = 10,068,347,520 sequences.

Frequently asked questions

What is the difference between a permutation and a combination?

A permutation is an arrangement where order matters (a race result); a combination is a selection where it does not (a hand of cards). For the same n and r, there are r! times as many permutations as combinations.

What do nPr and nCr stand for?

nPr is the number of permutations of n items taken r at a time, n!/(n − r)!. nCr is the number of combinations of n items taken r at a time, n!/(r!(n − r)!), also written C(n, r) or "n choose r".

How many combinations of 2 are there from 5?

There are 10. C(5, 2) = (5 × 4)/(2 × 1) = 10. If the order of the two matters, there are P(5, 2) = 20.

How many passwords or PIN codes are possible?

Characters can repeat and order matters, so use nʳ. A 4-digit PIN has 10⁴ = 10,000 options, and an 8-character password of lowercase letters has 26⁸ = 208,827,064,576.

What is 0! and why is C(n, 0) = 1?

0! is defined as 1, the value of an empty product. There is exactly one way to choose nothing, so C(n, 0) = 1 and P(n, 0) = 1.

What happens if r is larger than n?

Without repetition there is no way to choose more distinct items than exist, so P(n, r) and C(n, r) are 0. With repetition, r can exceed n: 3 scoops from 2 flavors gives C(4, 3) = 4 unordered choices.

How large can the numbers be?

n and r can go up to one billion. Results with up to 5,000 digits are computed exactly; larger ones are shown in scientific notation with their approximate digit count.

Factorial Calculator

Exact n! with steps and every digit, plus digit count, trailing zeros, n!! and Stirling’s approximation.

Number Theory & Bases

Binomial Distribution Calculator

Exact and cumulative binomial probabilities for up to a million trials, with steps, a table and a graph.

Statistics & Probability

Statistics Calculator

Mean, median, mode, five-number summary, IQR, outliers and SD with steps, a histogram and a box plot.

Statistics & Probability

Scientific Calculator

Type or tap expressions with exact fractions, memory, variables, constants and complex mode.

Tools

Step-by-Step Math Solver

Free worked solutions for equations, systems, inequalities, factoring, derivatives, integrals, limits and matrices.

Tools

Sources and further reading

  1. NIST Digital Library of Mathematical Functions, Chapter 26: Combinatorial Analysis (opens in a new tab), National Institute of Standards and Technology
  2. Algebra and Trigonometry 2e, Section 13.5: Counting Principles (opens in a new tab), OpenStax, Rice University
  3. math: Mathematical functions (math.comb and math.perm) (opens in a new tab), Python Software Foundation
  4. PERMUT function (opens in a new tab), Microsoft Support

Results are calculated in your browser with methods checked by automated tests, and are intended for learning and general use. For engineering, medical, financial, legal or safety-critical decisions, verify important values independently and follow the rounding rules your work requires. How accurate are these results?