CalcFolio

Permutation Calculator

This permutation calculator counts how many ordered arrangements of r items you can make from n distinct items, written nPr or P(n, r). Tick “repetition allowed” for codes and PINs where an item can be reused. The answer is exact, digit for digit, even when it runs to hundreds of digits, and you also see the matching number of combinations (nCr) and n factorial.

Updated

Whole number from 0 to 1,000

Whole number; no more than n unless repetition is allowed

How to use the calculator

  1. n: how many distinct items you can choose from (0 to 1,000).
  2. r: how many positions you fill, in order (0 to 1,000). Without repetition, r can't be larger than n.
  3. Repetition allowed: tick it when the same item may appear more than once, as with the digits of a PIN.

Results: the number of permutations, grouped in threes with spaces; a scientific approximation when the result has more than 15 digits; the combinations C(n, r) without repetition; n!; and how many digits the permutation count has.

Permutation formulas

Without repetition

The first position can be filled in n ways, the second in n − 1, and so on for r positions:

P(n, r) = n × (n − 1) × … × (n − r + 1) = n! ÷ (n − r)!

When r = n you are ordering the whole set, so P(n, n) = n!. By convention 0! = 1, so P(n, 0) = 1: there is exactly one way to choose nothing.

With repetition

Each of the r positions can take any of the n items:

n^r

Combinations

A combination ignores order. Each group of r items can be ordered in r! ways, so

C(n, r) = P(n, r) ÷ r! = n! ÷ (r! (n − r)!)

The combinations line always shows this no-repetition count, even when the box is ticked.

Exact big numbers

The calculator multiplies with arbitrary-precision integers, so nothing is rounded. For results over 15 digits it adds an approximation such as 8.06582 × 10^67, rounded to six significant digits. n! is printed in full up to n = 170; above that only the approximation is shown. With repetition, very large n^r values are capped at about 3,000 digits.

Examples

1. Podium finishes

Eight runners race for gold, silver and bronze. Order matters, so use n = 8, r = 3: 336 possible podiums. If you only care which three runners make the podium, the answer is C(8, 3) = 56.

2. Club officers

A club with 20 members elects a president, a vice president and a treasurer, with no one holding two posts: P(20, 3) = 6 840 ways. A three-person committee with no titles is C(20, 3) = 1 140.

3. PINs, codes and anagrams

SituationnrRepetitionArrangements
4-digit PIN104Yes10 000
4-digit PIN, all digits different104No5 040
6-digit code106Yes1 000 000
4-letter code, A–Z264Yes456 976
Anagrams of CRANE (5 different letters)55No120
Orders of a 52-card deck5252No8.06582 × 10^67 (68 digits)

The anagram count works only when all letters differ. For a word with repeated letters, divide n! by the factorial of each letter's count, because swapping identical letters doesn't create a new word.

Frequently asked questions

What is the difference between a permutation and a combination?

In a permutation the order matters; in a combination it doesn't. Picking first, second and third place from 10 people is P(10, 3) = 720, but picking a group of 3 is C(10, 3) = 120, since each group can be ordered in 3! = 6 ways.

How do you calculate nPr by hand?

Multiply r descending numbers starting at n. For P(10, 3): 10 × 9 × 8 = 720. That is the same as 10! ÷ 7!, without computing the large factorials.

When should I use permutations with repetition?

When an item can be used again in a later position: PIN digits, letters in a license-style code, outcomes of repeated dice rolls. Three positions filled from 5 options give 5^3 arrangements: the calculator shows 125 for n = 5, r = 3 with repetition, versus 60 without.

Why do I get an error when r is greater than n?

Without repetition you can't fill more positions than you have items: you can't seat 5 people in order using only 3 people. Tick “repetition allowed” if items may be reused.

What is 0! and why is P(n, 0) equal to 1?

0! is defined as 1 so that formulas like n! ÷ (n − r)! work when r = n. Choosing zero items can be done in exactly one way: choose nothing.

Sources

  1. Wolfram MathWorld — Permutation
  2. Wolfram MathWorld — Combination
  3. Khan Academy — Counting, permutations, and combinations

Results are exact counts for the values you enter. The scientific approximation is truncated to six significant digits.