Permutations and Combinations Calculator
Pick whether order matters and whether items can repeat, enter n and r, and get the exact count with the formula written out.
Number of ways
2,598,960
Formula
52C5 = 52! ÷ (5! × 47!) = 2,598,960
Scientific form
2.598960 × 10^6
Number of digits
7
How it works
Counting problems come down to two questions: does the order of the chosen items matter, and can an item be chosen more than once? A permutation is an ordered selection (a podium of gold, silver and bronze); a combination is an unordered one (a hand of cards, a lottery ticket). Without repetition, each pick removes an item from the pool; with repetition, the pool is unchanged after every pick (digits of a PIN, scoops of ice cream).
nPr counts ordered selections of r from n without repetition: n choices for the first slot, n − 1 for the second, and so on for r slots. nCr divides that by r!, the number of ways the same r items can be ordered, because order no longer distinguishes selections. With repetition there are nʳ ordered selections, and the unordered count is C(n + r − 1, r), the "stars and bars" formula.
A multiset is a collection with repeated items, such as the letters of MISSISSIPPI. Arranging all n of them in a row gives n! orders, but swapping identical copies does not produce a new arrangement, so the count is n! divided by the factorial of each kind's copy count.
The calculator works in exact integer arithmetic, forming nCr as a running product that stays an integer at every step, so 100C50 comes out as its exact 30 digits rather than a rounded floating-point value. Results beyond 2^1024 (about 1.8 × 10³⁰⁸, the limit of double precision) are shown in scientific form.
Formula
nPr = n! ÷ (n − r)! = n × (n − 1) × … × (n − r + 1) nCr = n! ÷ (r! (n − r)!) = Π (n − r + i) ÷ i for i = 1 … r with repetition: nʳ permutations, C(n + r − 1, r) combinations multiset: n! ÷ (n₁! × n₂! × … × nₖ!) where n = n₁ + n₂ + … + nₖ
Example
A 5-card poker hand from a 52-card deck is a combination: 52C5 = 52! ÷ (5! × 47!) = 2,598,960 hands. The ordered count, 52P5 = 52 × 51 × 50 × 49 × 48 = 311,875,200, is 5! = 120 times larger because each hand can be dealt in 120 orders.
A 6-from-49 lottery has 49C6 = 13,983,816 possible tickets; three-letter codes with repetition allowed number 26³ = 17,576; and choosing 6 cookies from 4 kinds with repetition gives C(4 + 6 − 1, 6) = 9C6 = 84 selections.
The 11 letters of MISSISSIPPI (1 M, 4 I, 4 S, 2 P) can be arranged in 11! ÷ (1! × 4! × 4! × 2!) = 34,650 distinct ways.
Assumptions and limitations
- n, r and the copy counts are whole numbers; n and r go up to 1,000 and each kind up to 1,000 copies. Larger inputs are refused rather than approximated.
- Without repetition, r cannot exceed n. With repetition, n must be at least 1; r = 0 always gives exactly 1 way (the empty selection).
- Kinds left at 0 copies contribute 0! = 1 to the divisor and do not affect a multiset count, so three kinds are entered by leaving the fourth at 0.
- Counts are exact integers while they are below 2^1024 ≈ 1.797 × 10^308; beyond that they are shown in scientific form with six decimal places.
- The calculator counts selections; it does not assign probabilities. For the chance of a particular outcome, divide the favourable count by the total.
Frequently asked questions
Does order matter for a lottery ticket or a committee?
No. A ticket with 3, 17 and 42 is the same ticket however the numbers are drawn, and a committee is the same set of people whoever was named first. Those are combinations. Use permutations when the positions differ: a president and a treasurer, the finishing order of a race, or the digits of a code.
Why is nCr always a whole number if the formula divides by r!?
Because among any r consecutive integers, one is divisible by r, one by r − 1, and so on, so the product n × (n − 1) × … × (n − r + 1) is always a multiple of r!. The calculator uses this: it multiplies by (n − r + i) and divides by i in turn, and the running value is an integer after every step.
More in Math & Geometry calculators.