Permutation and combination calculator
Permutations, combinations and the versions allowing repetition, with the probability that follows.
Order matters in a permutation and does not in a combination — picking first and second place versus picking two representatives. Factorials cannot be used directly at scale: 70! already overflows floating point to infinity, so this multiplies and divides only as far as it needs to. That is why values like 100C50 come out correctly.
Choose r from n
What you enter is saved in this browser, so it is still here next time
How many things there are to choose from.
How many of them you take.
Outcomes
Combinations nCr
8,145,060
Outcomes
- Permutations nPr
- 5,864,443,200
- With repetition nʳ
- 8,303,765,625
- Multiset nHr
- 15,890,700
- n!
- 1.1962e+56
Chance of hitting one
1.228e-7
One in
8,145,060
Too large to be exact.
Order matters in a permutation and not in a combination — first and second place versus two representatives.
Values beyond the safe integer range are shown approximately.
Six from 45 — how the five values separate
With the defaults n = 45 and r = 6, the permutation 45P6 is 45×44×43×42×41×40 = 5,864,443,200. The same six items can be arranged in 6! = 720 ways, so the combination 45C6 divides by 720 and gives 8,145,060. Permutations with repetition, 45⁶, come to 8,303,765,625; combinations with repetition, 45H6 = 50C6, to 15,890,700; and 45! to about 1.196×10⁵⁶. Five values from the same two numbers, differing by this much — choose by what you are counting, not by the name.
Counting without multiplying out the factorials
nCr is not computed as n!/(r!(n−r)!). The smaller of r and n−r is taken as k, then from 1 to k the running value is multiplied by (n−k+i) and divided by i, one step at a time. Each intermediate value is itself a binomial coefficient, so it stays an integer and never exceeds the answer. That is why 100C50 ≈ 1.0089×10²⁹ comes out. Above about 9.007 quadrillion (2⁵³) the trailing digits would be false even if written out, so the display switches to exponent form — from 20! = 2.4329×10¹⁸ onward. 171! exceeds floating point altogether and shows as ∞.
The probability is for one specific combination
The probability is 1/nCr: assuming every combination is equally likely, it is the chance that one combination chosen in advance is exactly the one drawn. For 45C6 that is 1.228×10⁻⁷, and the one-in figure is 8,145,060. The e-7 means the decimal point moves seven places to the left: 0.0000001228. Matching five of six, or a bonus number, is not counted — that is a different calculation, which splits the combinations by how many were matched and multiplies.
With repetition, r may exceed n
Permutations and combinations are 0 when r > n — there is not enough to choose from — and the screen warns. Permutations with repetition, nʳ, and combinations with repetition, (n+r−1)Cr, still have values in that case: for n = 3, r = 5, both 3P5 and 3C5 are 0, but 3⁵ = 243 and 3H5 = 7C5 = 21. A four-digit PIN has 10⁴ = 10,000 possibilities, and choosing four digits from 0–9 unordered with repeats allowed gives 10H4 = 13C4 = 715. Both n and r accept values up to 1,000.
Common questions
QWhat are the odds on a 6-from-45 lottery?
45C6 = 8,145,060 unordered selections, so one in about 8.1 million. Enter 45 and 6.
QWhen do I want combinations with repetition?
When the same item may be chosen more than once — two scoops from three flavours, same flavour allowed, is 3H2 = 6. It is computed as (n+r−1)Cr.