Combinations with Repetition Calculator
Enter the pool size (n) and the sample size (r) to find how many ways you can choose r items from n distinct types when the same type can be chosen more than once and order does not matter. The result comes from the stars-and-bars formula C(n+r-1, r). You also get the standard no-repetition count for comparison, the ratio between the two, and a full list of every combination when n and r are small enough.
Formula
Worked example
An ice-cream shop has 5 flavors (n=5) and you choose 3 scoops (r=3), repeats allowed. C(5+3-1, 3) = C(7, 3) = 7! / (3! x 4!) = 5040 / (6 x 24) = 35 distinct orders.
What are combinations with repetition?
A combination counts selections where order does not matter. Standard combinations require every item to be distinct. Combinations with repetition - also called multiset combinations - relax that rule and allow the same item type to be chosen more than once. If you are scooping three flavors of ice cream from a menu of five, you can pick chocolate twice and vanilla once. That selection is different from picking three distinct flavors. The formula that counts all such selections is C(n+r-1, r), where n is the number of distinct types and r is the number of items you choose.
The stars and bars formula explained
Imagine r stars (your chosen items) and n-1 bars (dividers between the n types). Every arrangement of those r stars and n-1 bars corresponds to exactly one way of distributing r items among n types. The total number of arrangements is C(r + n - 1, r) = (r+n-1)! / [r! x (n-1)!]. This is often called the stars-and-bars method and is one of the core techniques in combinatorics. For example, with 3 stars and 2 bars you can write ooo||, o|o|o, ||ooo, and so on - each arrangement is a unique multiset selection from 3 types.
Combinations with repetition vs. without repetition
Standard combinations without repetition use C(n, r) = n! / [r! x (n-r)!] and require r to be at most n. Combinations with repetition use C(n+r-1, r) and allow r to exceed n. When r is small relative to n, the two counts are close together. As r grows, the with-repetition count grows much faster because there are many more ways to pick items once repeats are allowed. The ratio output on this calculator shows the exact multiplier for your inputs.
When to use this formula
Use combinations with repetition whenever you are counting selections where the same type can appear multiple times and order does not matter. Common examples include: distributing identical objects into labeled bins, counting the number of multisets of a given size from a fixed alphabet, choosing toppings for a pizza when you can double or triple any topping, selecting playing card ranks for a hand when suits are ignored, or counting how many ways to spend a fixed number of tokens across several categories. If order does matter and repeats are allowed, use permutations with repetition instead (n^r).
Common combinations with repetition examples
| Pool size n | Sample size r | With repetition | Without repetition | Ratio |
|---|---|---|---|---|
| 3 | 2 | 6 | 3 | 2.00x |
| 4 | 2 | 10 | 6 | 1.67x |
| 5 | 3 | 35 | 10 | 3.50x |
| 6 | 3 | 56 | 20 | 2.80x |
| 10 | 2 | 55 | 45 | 1.22x |
| 10 | 3 | 220 | 120 | 1.83x |
| 10 | 5 | 2002 | 252 | 7.94x |
| 26 | 2 | 351 | 325 | 1.08x |
| 52 | 5 | 3478761 | 2598960 | 1.34x |
Quick-reference counts for typical values of n (pool size) and r (sample size). Results use C(n+r-1, r).
Frequently asked questions
What is the formula for combinations with repetition?
The formula is C'(n, r) = C(n+r-1, r) = (n+r-1)! / [r! x (n-1)!]. Here n is the number of distinct item types and r is the sample size. It is also written as the binomial coefficient C(n+r-1, r), meaning you choose r positions from n+r-1 total slots.
Can r be larger than n in combinations with repetition?
Yes. Because repeats are allowed, you can choose more items than there are types. For example, you can pick 5 scoops from 3 flavors (r=5 > n=3). The standard no-repetition formula breaks down in this case, but C(n+r-1, r) handles it correctly. In this example the answer is C(7, 5) = 21.
How does this differ from permutations with repetition?
Permutations with repetition count ordered sequences where repeats are allowed, and the count is n^r. Combinations with repetition count unordered selections where repeats are allowed, and the count is C(n+r-1, r). For n=3, r=2: permutations with repetition give 9 (AA, AB, AC, BA, BB, BC, CA, CB, CC), but combinations with repetition give only 6 (AA, AB, AC, BB, BC, CC) because BA counts as the same selection as AB.
What does the combination listing show?
When n is at most 20 and r is at most 20 and the total count does not exceed 5,000, this calculator lists every distinct combination. Each combination is shown as a sequence of item numbers (1 through n). A repeated number means that item type was chosen more than once.
What is the stars and bars method?
Stars and bars is a visual way to count combinations with repetition. Place r stars in a row representing r chosen items. Insert n-1 bars to divide the stars into n groups, one per item type. Every arrangement of r stars and n-1 bars is a unique selection. The number of such arrangements is C(r + n - 1, r), which is the same formula this calculator uses.
Why does the calculator show "ratio" as an output?
The ratio tells you how many times more combinations exist when repetition is allowed compared to when it is not. A ratio of 3.5 means there are 3.5 times as many selections possible with repetition. This is useful when deciding whether the stricter no-repetition model or the more flexible repetition model better matches your real-world problem.