Combinations and Permutations
Count the ways to choose r things from n — with or without order, with or without repeats.
Runs entirely in your browser. Nothing is uploaded, logged or stored.
How many ways
13983816
- The formula applied
- C(49, 6) = 49! / (6! × (49 − 6)!)
- Digits in the answer
- 8
Two questions decide which of the four you want: does the order they come out in matter, and may the same thing be picked twice? Every combinatorics problem people get wrong is one where those were answered without being asked.
How it works
A lottery draw is a combination: six numbers from forty-nine, and the order they roll out in changes nothing. A podium is a permutation: first, second and third are three different outcomes with the same three people. A four-digit PIN is a permutation with repetition, because 1111 is allowed.
The counts outgrow a machine integer almost at once — 21! already does — so the arithmetic here runs on decimal strings, digit by digit. An approximate count of arrangements is not a count of anything, and a floating-point answer stops being exact at about sixteen digits without ever saying so.
Combinations are built by multiplying and dividing alternately rather than by computing three factorials and dividing at the end. Every partial result is itself a whole number, so the digits never pile up beyond the answer.
Examples
| Case | Input | Result |
|---|---|---|
| A lottery draw — order does not matter | C(49, 6) | 13 983 816 |
| A podium — order matters | P(10, 3) | 720 |
| A four-digit PIN — repeats allowed | 10^4 | 10 000 |
| Larger than any machine integer | C(1000, 500) | a 300-digit number, exactly |
Frequently asked questions
Which one do I need?
Ask whether swapping two of the picked things gives a different outcome. If it does, you want permutations; if it does not, combinations. Then ask whether the same thing can be picked twice — a dice roll can, a hand of cards cannot.
Why is C(49, 6) the number of lottery tickets?
Because a draw is six numbers out of forty-nine with no repeats, and the order they are drawn in does not change the ticket. 13 983 816 is how many distinct tickets exist, which is also the odds against any one of them.
Why the limit at 1000?
Not because the arithmetic breaks — it does not — but because the answer stops being readable. 1000! is a 2568-digit number; 100000! would be several pages of digits nobody asked for.
Is zero to the zero one here?
Yes. There is exactly one way to arrange nothing from nothing — the empty arrangement — and that is the convention combinatorics uses throughout.
Good to know
- Every answer is exact, however many digits it runs to. Nothing here is rounded or written in scientific notation.