Combinations and Permutations Calculator: nCr and nPr
By Hesaplayıcı
The combinations and permutations calculator counts the ways to choose or arrange r of n items. Choose the type of count and enter n and r. It computes combinations and permutations, with or without repetition, as an exact number and shows every factorial. For example, a team of 3 from 10 people can be chosen in 120 ways.
Worked example: How many teams of 3 can be chosen from 10 people?
Number of ways
120
- Number of digits
- 3
Step by step
n! = 1 × 2 × … × n
10! = 1 × 2 × … × 10 = 3,628,800
r! = 1 × 2 × … × r
3! = 1 × 2 × 3 = 6
(n − r)! = 1 × 2 × … × (n − r)
7! = 1 × 2 × … × 7 = 5,040
Number of ways
C(n, r) = n! / (r! × (n − r)!)
C(10, 3) = 3,628,800 / (6 × 5,040) = 120
How to use
- In Type of count, choose whether the order matters and whether an item can be chosen again. For a team, a hand of cards or a group, the order does not matter: a combination. For a ranking, a code or a podium, the order matters: a permutation.
- In Number of items (n), enter how many different items there are, from 1 to 1,000.
- In Number chosen (r), enter how many items are chosen. Without repetition, r cannot be larger than n.
- Press Calculate. You get the number of ways, its number of digits and the steps.
Formula
C(n, r) = n! / (r! × (n − r)!), combinationsP(n, r) = n! / (n − r)!, permutationsC(n + r − 1, r) = (n + r − 1)! / (r! × (n − 1)!), combinations with repetitionnʳ, permutations with repetitionn! = 1 × 2 × … × n,0! = 1
n is the number of different items and r the number chosen. n! (n factorial) is the product of every whole number from 1 to n. A permutation counts each of the r! orders of a choice separately, so P(n, r) = C(n, r) × r!.
Worked example
The worked example on this page counts the teams of 3 that can be chosen from 10 people. The steps give 10!, 3! and 7! first, then put them into the combination formula.
Limits
The calculator takes whole numbers from 1 to 1,000 for n and from 0 to 1,000 for r. The result is exact and never rounded. Up to 21 digits it is written in full; a longer result shows its first 10 significant digits and a power of 10. The API and MCP results carry every digit. The calculator does not compute probabilities, arrangements of repeated letters (such as MISSISSIPPI) or circular arrangements.
Frequently Asked Questions
What is the difference between a combination and a permutation?
In a combination the order does not matter; in a permutation it does. A team of 3 from 10 people can be chosen in C(10, 3) = 120 ways; a president, a vice president and a secretary from the same 10 people in P(10, 3) = 720 ways.
What is the formula for combinations?
C(n, r) = n! / (r! × (n − r)!), where n is the number of items and r the number chosen. For example, C(5, 2) = 120 / (2 × 6) = 10.
How do you count permutations with repetition?
When any of the n items can fill each place, the count is nʳ. A 4-digit PIN from the digits 0 to 9 has 10⁴ = 10,000 possible values.
What are combinations with repetition?
Choices where an item can be picked more than once and the order does not matter. The count is C(n + r − 1, r): 3 donuts from 4 kinds can be picked in C(6, 3) = 20 ways.
Can r be larger than n?
Not without repetition: you cannot choose 6 different items from 5, so the calculator gives an error. With repetition you can; 6 candies from 3 kinds can be picked in C(8, 6) = 28 ways.
Why is 0! equal to 1?
There is exactly one way to arrange no items. This definition makes the formulas work at the ends too: C(n, 0) = C(n, n) = 1.
Calculation rules
- In a combination the order does not matter: {A, B} and {B, A} are the same choice. In a permutation the order matters. With repetition, an item can be chosen more than once.
- The result is exact and never rounded. Up to 21 digits it is written in full; a longer result shows its first 10 significant digits and a power of 10 (for example 2.702882409 × 10²⁹⁹). The API and MCP give every digit.
- 0! is 1, so C(n, 0) = C(n, n) = 1 and P(n, 0) = 1. Without repetition, an r larger than n gives an error.