Combinations and Permutations Calculator
This calculator works out how many ways you can select or arrange items from a set. Enter the total number of items (n) and how many you want to choose (r), and it instantly returns the number of combinations (nCr), the number of permutations (nPr), and the factorial of n (n!). Combinations answer "how many groups can I form?" when order does not matter — like picking 6 lottery numbers out of 49. Permutations answer "how many ordered arrangements are there?" when order does matter — like the possible podium finishes in a race. The results update as you type.
Combinations (nCr)
Permutations (nPr)
Factorial of n (n!)
Combinations count groups regardless of order; permutations do distinguish the order. For n greater than 170 the factorial exceeds the numeric range and shows as infinity.
Publicidad
How it works
The number of combinations of r items from n is nCr = n! / (r!·(n−r)!): you divide by r! precisely because rearranging the chosen items does not create a new group. The number of permutations is nPr = n! / (n−r)!: order counts, so each distinct arrangement is counted separately, which is why nPr is always at least as large as nCr (they are related by nPr = nCr·r!). Both build on the factorial, n! = n·(n−1)·(n−2)·…·2·1, the number of ways to arrange n distinct items in a row, with 0! defined as 1. This tool computes nCr and nPr with a multiplicative loop that avoids overflowing on the huge intermediate factorials, so it stays accurate for large n even when n! itself is too big to display.
Publicidad
Preguntas frecuentes
- What is the difference between a combination and a permutation?
- A combination is a selection where order does not matter, while a permutation is an arrangement where order does matter. Choosing 3 fruits out of 5 to put in a bowl is a combination; deciding which fruit goes first, second and third is a permutation. For the same n and r there are always at least as many permutations as combinations, since each combination can be reordered in r! ways.
- How do you calculate nCr?
- Use the formula nCr = n! / (r!·(n−r)!). For example, choosing 2 from 4 gives 4! / (2!·2!) = 24 / (2·2) = 6. In practice this calculator uses a multiplicative loop instead of computing the full factorials, so it stays accurate and fast even for large values of n.
- How do you calculate nPr?
- Use the formula nPr = n! / (n−r)!, which equals n·(n−1)·…·(n−r+1). For example, arranging 2 from 4 gives 4! / 2! = 24 / 2 = 12. You can also get it from combinations: nPr = nCr·r!.
- What is a factorial?
- The factorial of a whole number n, written n!, is the product of all positive integers up to n: n! = n·(n−1)·…·2·1. So 5! = 5·4·3·2·1 = 120. By convention 0! = 1. Factorials grow extremely fast, which is why this calculator shows n! as infinity once n exceeds 170 — beyond that the value is too large for standard numbers.
- What happens if r is larger than n?
- If r is greater than n there are no valid selections or arrangements, so both nCr and nPr are 0 — you cannot choose more items than exist. The calculator also treats negative values of r as 0. When r equals 0, there is exactly one combination (the empty selection) and one permutation.