CCalculate.Studio

🔀 Permutation and Combination Calculator

Permutations count the number of ways to arrange r items from a set of n where order matters, while combinations count the number of ways to choose r items from a set of n where order does not matter. This calculator computes both nPr and nCr, along with the repetition-allowed versions of each, for whole numbers n and r with r ≤ n.

Dernière vérification: 2026-07-07

Choosing the right formula: order and repetition

Four distinct counting formulas apply depending on two independent yes/no questions: does order matter, and is repetition allowed?

Order matters?Repetition allowed?FormulaExample scenario
YesNonPr = n! ÷ (n − r)!Awarding 1st/2nd/3rd place among 7 runners
YesYesCreating a 3-digit PIN from digits 0–6, repeats allowed
NoNonCr = n! ÷ (r!(n−r)!)Choosing a 3-person committee from 7 people
NoYesC(n+r−1, r)Choosing 3 scoops from 7 ice cream flavors, repeats allowed
  • nCr is always less than or equal to nPr for the same n and r (specifically nCr = nPr ÷ r!), because combinations collapse every group of r! orderings of the same items into a single count.
  • When r = 0, both nPr and nCr equal 1 by convention — there is exactly one way to select zero items (the empty selection).
  • When r = n (no repetition), nPr = n! and nCr = 1 — there is only one way to 'choose' all n items as an unordered set, but n! ways to arrange all of them in order.

What are permutations and combinations?

A permutation is an arrangement of items in which the order matters. The number of permutations of r items selected from a set of n distinct items (without repetition) is written nPr and counts arrangements such as 'first place, second place, third place' where swapping two selected items produces a different, distinct outcome.

A combination is a selection of items in which the order does not matter. The number of combinations of r items chosen from n distinct items is written nCr (also called 'n choose r' or the binomial coefficient) and counts groupings such as a committee or a hand of cards, where the same set of items in a different order is considered the same outcome.

The key distinguishing question is: does rearranging the same selected items produce a different result? If yes (e.g. assigning gold/silver/bronze medals, or arranging books on a shelf), use permutations. If no (e.g. choosing a 3-person committee, or picking a hand of cards), use combinations. This calculator also reports the 'with repetition' variants, which apply when the same item can be selected more than once (e.g. choosing digits for a PIN, or scoops of ice cream flavors where repeats are allowed).

How to use this permutation and combination calculator

  1. Enter n — the total number of distinct items available to choose from.
  2. Enter r — the number of items to be selected or arranged. r must be less than or equal to n for the no-repetition results (repetition-allowed results permit any r ≥ 0).
  3. Read the permutations (nPr) if the order of selection matters and repetition is not allowed, or combinations (nCr) if order does not matter and repetition is not allowed.
  4. For scenarios allowing the same item to be chosen more than once, use the 'with repetition' results instead of the standard nPr/nCr values.

The permutation and combination formulas

Permutations (no repetition): nPr = n! ÷ (n − r)!
Combinations (no repetition): nCr = n! ÷ (r! × (n − r)!)
Permutations with repetition: nʳ
Combinations with repetition: C(n + r − 1, r)
Example: n = 7, r = 3 → 7P3 = 210, 7C3 = 35, 7³ = 343, C(9,3) = 84

The number of permutations of r items chosen from n, without repetition, is nPr = n! ÷ (n − r)!, equivalently the product of r consecutive descending integers starting at n. Worked example with n = 7, r = 3: 7P3 = 7 × 6 × 5 = 210 — the number of ways to award distinct 1st, 2nd and 3rd place prizes among 7 competitors.

The number of combinations of r items chosen from n, without repetition, is nCr = n! ÷ (r! × (n − r)!) = nPr ÷ r!. This divides out the r! ways of ordering each selected group, since combinations do not distinguish order. Worked example with n = 7, r = 3: 7C3 = 210 ÷ 3! = 210 ÷ 6 = 35 — the number of distinct 3-person committees that can be formed from 7 people.

Permutations with repetition allowed (each of the r positions can independently be any of the n items) is simply nʳ. For n = 7, r = 3: 7³ = 343 — for example, the number of distinct 3-digit codes using digits 0–6 if repeats are allowed. Combinations with repetition allowed uses the 'stars and bars' formula C(n + r − 1, r). For n = 7, r = 3: C(9, 3) = 84 — for example, the number of ways to choose 3 scoops of ice cream from 7 flavors when repeated flavors are allowed and order doesn't matter.

Common mistakes

  • Using the permutation formula when order does not actually matter (or vice versa) — check whether swapping two selected items changes the outcome before choosing a formula.
  • Forgetting to check whether repetition is allowed — 'choosing a PIN' (digits can repeat) needs a different formula from 'dealing cards from a deck' (no repetition, cards do not return to the deck).
  • Applying nPr or nCr with r greater than n when repetition is not allowed — this is undefined, since you cannot select more distinct items than exist in the set without repeating one.
  • Confusing 'combinations with repetition' (the stars-and-bars formula) with plain nCr — these give very different results and apply to different scenarios (repeats allowed vs. not).

Questions fréquentes

What is the difference between a permutation and a combination?

A permutation counts arrangements where order matters (nPr = n! ÷ (n−r)!) — for example, ranking 1st, 2nd and 3rd place. A combination counts selections where order does not matter (nCr = n! ÷ (r!(n−r)!)) — for example, choosing a committee. For n = 7 and r = 3: 7P3 = 210 (ordered), but 7C3 = 35 (unordered), because each group of 3 people can be arranged in 3! = 6 different orders, and 210 ÷ 6 = 35.

How do you calculate nCr (n choose r)?

Use the formula nCr = n! ÷ (r! × (n − r)!). For n = 7, r = 3: 7C3 = 7! ÷ (3! × 4!) = 5040 ÷ (6 × 24) = 5040 ÷ 144 = 35. Equivalently, compute nPr first (7 × 6 × 5 = 210) and divide by r! (3! = 6): 210 ÷ 6 = 35.

How do you calculate nPr?

Use the formula nPr = n! ÷ (n − r)!, which simplifies to the product of r consecutive descending integers starting from n. For n = 7, r = 3: 7P3 = 7 × 6 × 5 = 210.

When should I allow repetition in a permutation or combination problem?

Allow repetition when the same item can be selected more than once in a single outcome — for example, digits in a PIN code, or ice cream flavors when a customer can choose the same flavor for multiple scoops. Do not allow repetition when each item can only be used once — for example, dealing distinct playing cards, or assigning distinct people to roles.

What is nPr when r equals n?

When r = n (arranging all n items with no repetition), nPr simplifies to n! ÷ (n − n)! = n! ÷ 0! = n! ÷ 1 = n!. This represents the total number of ways to arrange all n distinct items in a row — for example, 5 items can be fully arranged in 5! = 120 ways.

What does 'stars and bars' mean for combinations with repetition?

'Stars and bars' is the standard combinatorial technique for counting combinations with repetition allowed, giving the formula C(n + r − 1, r). It works by representing the r chosen items as 'stars' separated by 'bars' marking the boundaries between the n categories, then counting the arrangements of stars and bars. For n = 7, r = 3: C(9, 3) = 84.

Références

  1. Rosen KH. Discrete Mathematics and Its Applications. 8th ed. McGraw-Hill, 2018. (Permutations, combinations, and the stars-and-bars method.)
  2. NIST Digital Library of Mathematical Functions (DLMF), §26.1–26.3 Combinatorial Analysis. dlmf.nist.gov.
  3. Feller W. An Introduction to Probability Theory and Its Applications, Vol. 1. 3rd ed. Wiley, 1968. (Classic treatment of permutations and combinations.)

Théorie des nombres · Tous les calculateurs

Calculateurs associés

Guides & articles