Combinatorics Calculator: Permutations, Arrangements and Combinations
Calculator
Combinatorics Calculator
Permutations, arrangements and combinations, simple and with repetition, with the formula and the list of groups
n is the number of elements to choose from, k how many you take for each group. Results are exact up to n = 1,000, even when they have thousands of digits (long numbers are abbreviated, all digits remain viewable); the list of groups appears when there are at most 200 of them with at most 2,000 elements in total. All calculations take place in your browser. The calculator does not choose the type of grouping for you: if the result does not add up, ask yourself whether order matters and whether elements can be repeated.
Proteggi la tua casa con la smart home
Telecamere, videocitofoni e serrature IoT di Imou. Installazione semplice, controllo da app, affidabilità provata.
More Details
What combinatorics is
Combinatorics is the branch of mathematics that counts in how many ways objects can be chosen or ordered, without having to list them one by one. There are always two questions: does order matter? and can an element be repeated? The answers give rise to the three fundamental groupings: permutations, arrangements and combinations, each either simple or with repetition.
How to use the calculator
Choose what you want to calculate, enter the total number of elements n and how many you take for each group k, then press «Calculate» or Enter. You get the exact result with the formula, a summary of all counts for the same n and k and, when there are at most 200 groups, their complete list. If you enter the element names separated by commas (for example «red, green, blue») the list uses them instead of letters. For permutations with repetition, indicate how many times each element repeats: for the anagrams of MAMMA enter n = 5 and repetitions «3, 2».
n and k are whole numbers: you can use a period as the thousands separator (1.000), while a value with decimals such as 2,5 is rejected with a message. The calculation takes place in your browser and no data is sent.
The formulas
| Grouping | Order | Repetition | Formula |
|---|---|---|---|
| Simple permutations | matters | no | P(n) = n! |
| Permutations with repetition | matters | yes | n! / (r₁! · r₂! · …) |
| Simple arrangements | matters | no | D(n, k) = n! / (n − k)! |
| Arrangements with repetition | matters | yes | D′(n, k) = nk |
| Simple combinations | does not matter | no | C(n, k) = n! / (k! · (n − k)!) |
| Combinations with repetition | does not matter | yes | C′(n, k) = (n + k − 1)! / (k! · (n − 1)!) |
The symbol n! is read «n factorial» and is the product of all whole numbers from 1 to n: 5! = 5 · 4 · 3 · 2 · 1 = 120. By convention 0! = 1. The number of simple combinations is the binomial coefficient, read «n choose k», and combinations with repetition can be reduced to simple ones: C′(n, k) = C(n + k − 1, k).
Calculation example
These results are produced by the calculator with the values shown:
| Problem | Grouping and calculation | Result |
|---|---|---|
| 5 people to put in a line | simple permutations, 5! | 120 |
| Anagrams of MAMMA (M 3 times, A 2) | permutations with repetition, 5! / (3! · 2!) | 10 |
| Possible podiums with 8 runners | simple arrangements, 8 · 7 · 6 | 336 |
| 4-digit PIN, each digit from 0 to 9 | arrangements with repetition, 104 | 10,000 |
| Sets of 6 numbers chosen from 1 to 90 | simple combinations, C(90, 6) | 622,614,630 |
| 5-card hands from a 52-card deck | simple combinations, C(52, 5) | 2,598,960 |
| Cone with 3 scoops chosen from 5 flavours, repeats allowed | combinations with repetition, C(7, 3) | 35 |
The PIN deserves a clarification. In everyday language we speak of the «combination» of a padlock or a safe, but in mathematics it is an arrangement with repetition: 1234 and 4321 are different codes and the same digit can appear more than once. If order did not matter, the groups of 4 digits would be only C′(10, 4) = 715.
Arrangements or combinations: how to choose
Ask yourself whether swapping two elements gives a different result. In a race, the podium Rossi-Bianchi-Verdi is not the same as Bianchi-Rossi-Verdi: order matters, so these are arrangements. In a lottery ticket or a hand of cards, the same numbers taken in a different order are the same play: order does not matter, so these are combinations. Permutations are the case in which you use all n elements, i.e. arrangements with k = n. For the same reason, simple arrangements are always k! times simple combinations: D(5, 3) = 60 and C(5, 3) = 10, with 3! = 6.
Very large numbers and limits
Counts grow quickly: 1,000! has 2,568 digits. The calculator works with exact whole numbers up to n = 1,000; beyond 21 digits the result is shown abbreviated, for example 1,000! ≈ 4.02 × 102567, and with «Show all digits» you can read it in full. The list of groups appears only when there are at most 200 of them with at most 2,000 elements in total: beyond that, the page would become unreadable. The exact calculation uses the browser's big integers (BigInt); on a very old browser that does not support them, a message appears instead of the result.
The calculator counts the classic groupings and does not handle additional constraints, such as «at least one element of a certain type» or circular arrangements: in those cases the problem must be set up by hand, often by adding or subtracting several counts. Choosing the right grouping remains up to you.
Frequently asked questions
What is the difference between arrangements and combinations?
In arrangements order matters, in combinations it does not. With 8 runners the possible podiums are 336 arrangements, because first, second and third are different places; the groups of 3 runners without order are instead 56 combinations. The ratio is always k!: 336 / 56 = 6 = 3!.
Is a 4-digit PIN a combination or an arrangement?
It is an arrangement with repetition, even though in everyday language it is called a «combination»: the order of the digits matters and the same digit can be repeated. The possible PINs are 10⁴ = 10,000. If order did not matter there would be only 715.
Why is 0! equal to 1?
By convention, and it is the choice consistent with counting: zero objects can be ordered in only one way, namely by doing nothing. Thanks to this convention the formulas work even in edge cases: C(n, n) = n! / (n! · 0!) = 1, because there is only one way to take all the elements.
How do you count the anagrams of a word with repeated letters?
With permutations with repetition: divide the factorial of the number of letters by the factorial of how many times each letter repeats. The anagrams of MAMMA are 5! / (3! · 2!) = 10, those of ANNA 4! / (2! · 2!) = 6.
Related tools: to draw random numbers instead of counting them, use the random number generator; for powers such as nk there is the exponent calculator.