ThisCalculator

Home and garden

Combination Calculator with Repetition

Updated · Standard formula, shown below

Combinations with repetition 35
Number of item types (n)
5
You entered
Number chosen (r)
3
You entered

Combination Calculator with Repetition

This calculator works out the number of combinations with repetition (also called multisets or k-combinations with repetition) for a given set size n and selection size r. You enter the total number of item types (n) and how many you choose (r), and it returns the count of distinct ways to pick r items when order does not matter and repeats are allowed. The result is the binomial coefficient C(n+r−1, r).

Formula

The number of combinations with repetition is given by the formula:

C(n + r − 1, r) = (n + r − 1)! / [r! × (n − 1)!]

Where:

  • n = number of distinct item types (e.g., 5 flavors of ice cream)
  • r = number of items you choose (e.g., 3 scoops)
  • C(n + r − 1, r) = the count of possible multisets

This formula comes from the “stars and bars” method: imagine placing r identical stars (the chosen items) among n bins (the types), separated by n−1 bars. The total positions are n+r−1, and you choose where to put the r stars.

Worked Example

Using the default values from the calculator: n = 5 item types, r = 3 chosen.

  1. Compute n + r − 1 = 5 + 3 − 1 = 7.
  2. Compute C(7, 3) = 7! / (3! × (7−3)!) = 7! / (3! × 4!).
  3. 7! = 5040, 3! = 6, 4! = 24.
  4. So C(7, 3) = 5040 / (6 × 24) = 5040 / 144 = 35.

The calculator returns 35 combinations with repetition.

When to Use Combinations with Repetition

Use this when you are selecting r items from n categories, where:

  • Order does not matter (choosing chocolate then vanilla is the same as vanilla then chocolate)
  • You can pick the same category more than once (repetition allowed)

Real examples include:

  • Choosing 3 scoops of ice cream from 5 flavors (you can have double chocolate)
  • Distributing 10 identical candies among 4 children
  • Selecting 2 toppings for a pizza from 6 options, where you can double up on one topping
  • Counting the number of non-negative integer solutions to xâ‚� + xâ‚‚ + … + xâ‚™ = r

If order matters, use permutations with repetition (n^r). If repetition is not allowed, use the standard combination formula C(n, r).

How to Read the Result

The result is a count, not a list. It tells you how many distinct multisets exist. For example, with n=5 and r=3, the 35 combinations include possibilities like (chocolate, chocolate, vanilla) and (strawberry, lemon, mint), but (vanilla, chocolate, chocolate) is not counted separately because order is ignored.

Note that the result grows quickly. For n=10 and r=10, the count is C(19,10) = 92,378. For n=50 and r=50, it is about 10^29. This is why a calculator is useful for even moderate inputs.

Common Mistakes and Misconceptions

  • Confusing with permutations with repetition: If order matters, the count is n^r, not C(n+r−1, r). Example: rolling two dice (order matters) has 6^2 = 36 outcomes, but combinations with repetition for n=6, r=2 gives C(7,2)=21.
  • Forgetting to add n−1: The formula is C(n+r−1, r), not C(n, r). A common error is using C(n, r) which ignores repetition.
  • Using the wrong r: Make sure r is the number of items you choose, not the number of types. If you choose 3 scoops from 5 flavors, r=3, n=5.
  • Assuming the result is a list: The calculator gives a count, not the actual combinations. For small n and r you can list them by hand, but for larger values it is impractical.

Limits of the Formula

The formula assumes:

  • All n types are distinct and each can be chosen any number of times (unlimited repetition).
  • You are choosing exactly r items, not at most r.
  • The items are unlabeled except for their type (i.e., choosing two chocolates is the same regardless of which chocolate scoop is first).

If repetition is limited (e.g., at most 2 of each type), the formula does not apply directly; you would need generating functions or inclusion-exclusion. If the types are not distinct (e.g., two flavors are identical), the count changes.

Frequently Asked Questions

What is the difference between combinations with repetition and without?

Without repetition, each item can be chosen at most once, so the count is C(n, r). With repetition, you can choose the same item multiple times, so the count is C(n+r−1, r). For example, choosing 2 scoops from 3 flavors: without repetition you have 3 options (A,B), (A,C), (B,C); with repetition you have 6 options (A,A), (A,B), (A,C), (B,B), (B,C), (C,C).

Why is the formula C(n+r−1, r) instead of C(n, r)?

The “stars and bars” method shows that choosing r items with repetition from n types is equivalent to arranging r stars and n−1 bars in a line. The total positions are n+r−1, and you choose which r of those are stars, giving C(n+r−1, r). The extra n−1 accounts for the bars that separate the types.

Can I use this for distributing identical items?

Yes. If you have r identical candies to distribute among n children, the number of ways is exactly C(n+r−1, r). For example, 4 candies to 3 children gives C(3+4−1, 4) = C(6,4) = 15 ways.

What if order matters but repetition is allowed?

Then use permutations with repetition, which is simply n^r. For example, rolling two dice (order matters) has 6^2 = 36 outcomes, while combinations with repetition would give 21.

How do I list all combinations with repetition?

For small n and r, you can generate them recursively: start with the first type, then for each selection, either stay on the same type (repeat) or move to the next type. There is no simple closed-form list, but many programming languages have libraries for multisets. For n=5, r=3, you could write them out manually, but for larger values it is impractical.

Related

Formula used
in n | Number of item types (n) | - | 5 | 1
in r | Number chosen (r) | - | 3 | 0
out combos | Combinations with repetition | - | ncr(n + r - 1, r) | 0

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.