Combinations with Repetition Calculator
Choose 3 scoops from 5 ice-cream flavours, flavours may repeat, order does not matter: how many possible cups? Not C(5,3) = 10 — repetition rewrites the counting. The answer is C(5+3−1, 3) = 35, by the beautiful device called stars and bars. This calculator computes combinations with repetition for any numbers of types and choices, and — because the pair are confused so often — it also returns the permutation-with-repetition count n^r (order matters, repetition allowed) and the plain no-repetition combination, so the three neighbouring counts can be compared in one place. Bring any choosing problem — scoops, coins, budget lines, balls in bins — and its two classification questions; the page returns its census and the two neighbours it is most often mistaken for.
Stars and Bars: The Proof in One Picture
Represent a cup by its flavour counts — say 2 vanilla, 0 chocolate, 1 mint, 0 strawberry, 0 mango — as a row of symbols: ★★ | | ★ | | , three stars (the three scoops) separated by four bars (the fences between five flavours, in a fixed flavour order). Every cup corresponds to exactly one such string, and every string to exactly one cup: a bijection, combinatorics' certificate of equal counts. The string has n + r − 1 = 7 symbols of which r = 3 are stars (equivalently n − 1 = 4 are bars), so the count is C(7,3) = 35 — the formula C(n+r−1, r), proved rather than asserted. The same picture prices every multiset in creation: doughnuts chosen from a bakery case, balls dropped into bins, indistinguishable dice totals, budget units spread across departments. Whenever the question is "how many of each type, order irrelevant, stock unlimited", the stars and bars are already laid out, and the only skill left is recognising the situation in costume.
The Three Neighbours, Disentangled
Most counting errors are one of three formulas answering another's question, so the calculator prints all three side by side for the defaults. Combinations with repetition (order irrelevant, repeats allowed): 35. Permutations with repetition (order matters, repeats allowed): each of the r positions independently offers n types, so n^r = 5³ = 125 — the count for codes, licence plates and lottery-style draws with replacement; it is always the largest of the three, because it makes the finest distinctions. Plain combinations (no repeats, order irrelevant): C(5,3) = 10 — the smallest, because it forbids the most. The diagnostic questions that route a problem to its formula are two: does order matter? and can items repeat? — two binary questions, four cells (the fourth, permutations without repetition, is n!/(n−r)!), and every elementary counting problem lives in one of them. Naming the cell before computing is the whole craft, and it takes ten seconds once the two questions are habits; the hub's other counting tools take their cells, and this page's triple display exists so the contrast can be seen in numbers, not merely recited.
Where Multisets Rule
The with-repetition combination is the quiet workhorse of distribution problems. Probability denominators: the equally likely outcomes of rolling two dice as unordered pairs number C(6+2−1, 2) = 21, not 36 — the correct sample space for some questions and the seductive error for others (the 21 pairs are not equally likely, a trap this formula's elegance keeps setting). Equations in disguise: the number of non-negative integer solutions of x₁ + x₂ + x₃ = 10 is C(12, 2) = 66 — the variables are the types, the units are the choices, and half of integer-partition problems in contests and operations research enter through this door. Statistics itself: the Bose–Einstein distribution counts physical states exactly this way (indistinguishable particles, unlimited occupancy), against the Maxwell–Boltzmann n^r counting of the permutation formula — two of this page's three numbers govern different universes of physics, which is as close as elementary combinatorics comes to cosmology. Recognising the multiset structure is the step; the calculator's part is arithmetic.
Growth, and Respecting Large Counts
These counts outgrow intuition on schedule. Ten types, ten choices: C(19, 10) = 92,378 multisets against 10¹⁰ ordered strings — repetition collapses the ordered world by five orders of magnitude, while still exploding combinatorially itself. The calculator computes by the multiplicative form of the binomial coefficient (multiplying and dividing term by term) to stay exact as long as the double-precision integers hold — comfortably into the trillions — and reports beyond that with the figures understood as precise to the digits shown. For the gambler's version of humility: a lottery asking for 6 numbers from 49 with repetition allowed and order ignored would offer C(54, 6) ≈ 25.8 million combinations against the real game's C(49, 6) ≈ 14.0 million — the rule changes are never cosmetic; they are the odds themselves, which is the permanent reason for this family's precision about what, exactly, is being counted.
Two Classroom Staples, Priced
The formula's two most-assigned exercises, run for the record. The bakery order: a box of 6 doughnuts chosen from 12 types, any mix — C(12+6−1, 6) = C(17, 6) = 12,376 possible boxes, a number that surprises everyone who guessed in the hundreds and explains why "surprise me" is a real instruction at the counter. The solutions count: non-negative integer solutions of x₁ + x₂ + x₃ = 10 — distribute 10 indistinguishable units among 3 variables — number C(12, 2) = 66; demand each variable be at least 1 (pre-place one unit in each) and the remaining 7 distribute as C(9, 2) = 36. Both are the defaults' ice-cream problem in different aprons: types, choices, stars, bars — and the recognition, once practised, takes less time than the arithmetic it unlocks.
Coins Among Children
The distribution form, one more time in its most domestic dress: 20 identical coins shared among 4 children, any split — the children are the types, the coins the choices — C(23, 3) = 1,771 possible sharings. Add fairness by force — every child guaranteed at least 2 coins — and the standard trick pre-places the guaranteed 8, leaving 12 free coins to distribute as C(15, 3) = 455 sharings. The pre-placement move (satisfy the minimums first, then count the free remainder) converts a whole family of constrained problems back into the calculator's unconstrained one, and it is worth learning here, with coins, rather than later, with budgets.
Related Tools
More from the Statistics Calculators hub: the AND Probability Calculator for turning counts into chances, the live Coin Toss Streak Calculator for sequences counted the ordered way, and the Shannon Entropy Calculator for what a count of possibilities means in bits.
Frequently Asked Questions
Why is it C(n+r−1, r) and not C(n+r, r) or C(n, r)?
Because the stars-and-bars string has exactly n + r − 1 positions: r stars plus n − 1 bars (the fences between n types number one fewer than the types, as fences between fields do). Choosing the star positions among those gives C(n+r−1, r); choosing the bar positions gives C(n+r−1, n−1), the same number by the binomial's symmetry — a useful cross-check the calculator's formula satisfies identically.
When is repetition actually allowed in real problems?
Whenever the stock is not depleted by choosing: scoops from a tub that serves many, dice faces, code digits, balls drawn with replacement, indistinguishable units of money across budget lines, identical items into distinct boxes. The giveaway phrase is "with replacement" or its physical equivalents (unlimited supply, items indistinguishable, categories rather than individuals). When each item can be taken only once, the problem belongs to the plain formulas.
Are the 21 unordered dice pairs a valid sample space?
Valid as a listing, treacherous as a probability space: the pair {3,4} arises from two ordered throws while {3,3} arises from one, so the 21 outcomes carry unequal weights (2/36 against 1/36). Counting with this calculator gives the inventory correctly; probabilities over that inventory must weight doubles and mixed pairs differently — or retreat to the 36 ordered outcomes where uniformity lives. The distinction bankrupts more puzzle-solvers than any formula in this family.
How does this relate to permutations with repetition?
They are the ordered and unordered readings of one situation, and the calculator prints both to fix the relationship in memory: ordered counts each arrangement separately (n^r), unordered collapses arrangements differing only by order — but not by the plain r! division of the no-repetition case, because repeated items have fewer distinct arrangements (a cup of 3 identical scoops permutes in 1 way, not 6). That uneven collapse is exactly why stars and bars, not division, is the correct instrument here.
What is the largest input the calculator handles?
The multiplicative binomial stays exact (integer-exact) while the count remains below about 9 × 10¹⁵, which covers any conceivable hand-posed problem — n and r in the dozens already produce counts in the billions. Beyond that range the display remains accurate to its shown digits. If your counting problem overflows a classroom calculator's honesty, it is telling you something about the problem's scale that the exact digits would not improve.
Can order matter AND repetition be forbidden in the same tool?
That cell — permutations without repetition, n!/(n−r)! — is a sibling instrument on this hub (arrangements of distinct items in sequence: podium finishes, distinct-digit codes). The four cells together exhaust the elementary counting table; the two questions (order? repeats?) classify any new problem in seconds, and this page's FAQ exists because mis-classification, not arithmetic, is where counting goes to die.