Sometimes you can pick the same kind of item more than once: three scoops of ice cream from five flavours, a dozen doughnuts from six varieties or five coins from four denominations. Order still does not matter – chocolate-vanilla-chocolate is the same cup as chocolate-chocolate-vanilla. These are combinations with repetition, also called multisets.
The count comes from the “stars and bars” argument: picture the r chosen items as stars and separate the n types with n − 1 bars. Every arrangement of r stars and n − 1 bars is one selection, so the count is C(n + r − 1, r). Three scoops from five flavours gives C(7, 3) = 35, compared with only C(5, 3) = 10 if all scoops had to differ.
Type the item types (flavours, colours, coins) or just their number, choose r and the calculator returns the exact count, the comparison with ordinary combinations and, for up to 300 results, the full list of selections with repeats shown.
How to use the Combinations With Repetition Calculator
- Number of types to choose from (n) — Ignored when you type the objects themselves below.
- Number of items chosen (r), repeats allowed
- Objects to list (optional, comma-separated) — If you type names here, n is taken from how many you entered and the list below uses them.
- List the selections
Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.
How it works
n + r − 1 positions are filled with r stars and n − 1 bars; the number of ways to choose where the stars go is the binomial coefficient C(n + r − 1, r). Listing generates non-decreasing sequences of types.
Worked example
Five flavours, three scoops, repeats allowed: C(5 + 3 − 1, 3) = C(7, 3) = 7 × 6 × 5 ÷ 6 = 35 cups. They split into 5 cups of a single flavour, 20 with one flavour doubled (5 × 4) and 10 with three different flavours. 5 + 20 + 10 = 35.
With vs without repetition
| n | r | Without repetition C(n, r) | With repetition C(n + r − 1, r) |
|---|---|---|---|
| 5 | 3 | 10 | 35 |
| 6 | 12 | — | 6,188 |
| 10 | 5 | 252 | 2,002 |
| 26 | 5 | 65,780 | 142,506 |
Formula
C′(n, r) = C(n + r − 1, r) = (n + r − 1)! ÷ (r! × (n − 1)!)
Worked example
Inputs — Number of types to choose from (n): 5; Number of items chosen (r), repeats allowed: 3; Objects to list (optional, comma-separated): Vanilla, Chocolate, Strawberry, Mint, Mango; List the selections: Yes – show up to 300.
Results — Combinations with repetition = 35; Chance of one particular selection (if all equally likely) = 1 in 35 (2.857143%); Without repetition, for comparison = 10; Ordered sequences with repetition (nʳ) = 125; Note = n = 5 (counted from the objects you listed); All selections = {Vanilla, Vanilla, Vanilla} {Vanilla, Vanilla, Chocolate} {Vanilla, Vanilla, Strawberry} {Vanilla, Vanilla, Mint}
{Vanilla, Vanilla, Mango} {Vanilla, Chocolate, Chocolate} {Vanilla, Chocolate, Strawberry} {Vanilla, Chocolate, Mint}
{Vanilla, Chocolate, Mango} {Vanilla, Strawberry, Strawberry} {Vanilla, Strawberry, Mint} {Vanilla, Strawberry, Mango}
{Vanilla, Mint, Mint} {Vanilla, Mint, Mango} {Vanilla, Mango, Mango} {Chocolate, Chocolate, Chocolate}
{Chocolate, Chocolate, Strawberry} {Chocolate, Chocolate, Mint} {Chocolate, Chocolate, Mango} {Chocolate, Strawberry, Strawberry}
{Chocolate, Strawberry, Mint} {Chocolate, Strawberry, Mango} {Chocolate, Mint, Mint} {Chocolate, Mint, Mango}
{Chocolate, Mango, Mango} {Strawberry, Strawberry, Strawberry} {Strawberry, Strawberry, Mint} {Strawberry, Strawberry, Mango}
{Strawberry, Mint, Mint} {Strawberry, Mint, Mango} {Strawberry, Mango, Mango} {Mint, Mint, Mint}
{Mint, Mint, Mango} {Mint, Mango, Mango} {Mango, Mango, Mango}
All 35 listed..
Key terms
- Multiset
- A collection where elements may repeat but order does not matter.
- Stars and bars
- A counting method that turns multisets into arrangements of stars and dividers.
- Type
- One of the n kinds of item that can be chosen.
Frequently asked questions
How many ways can I choose 3 scoops from 5 flavours?
With repeats allowed, C(7, 3) = 35; with all different flavours, C(5, 3) = 10.
What is the formula for combinations with repetition?
C(n + r − 1, r) = (n + r − 1)! ÷ (r!(n − 1)!).
Why is it called stars and bars?
The r items are drawn as stars and n − 1 bars split them into the n types; each arrangement is a selection.
Can r be larger than n?
Yes. A dozen doughnuts from 6 varieties is C(17, 12) = 6,188.
How many ways can I pick 5 digits if repeats are allowed and order does not matter?
C(14, 5) = 2,002.
Are all selections equally likely?
Not if you draw items one by one at random – {A, A} is less likely than {A, B} – so the "chance" output assumes each selection is equally likely.