Combinations with Repetition Calculator

Count combinations when repeats are allowed.

How it is calculated

This counts the ways to choose r items from n types when an item may be picked more than once and the order of picking does not matter: C(n + r − 1, r) = (n + r − 1)! / (r! × (n − 1)!). It is the classic "stars and bars" count. Both inputs are rounded to whole numbers; n must be at least 1 and r at least 0 (choosing none gives 1 way). The tool multiplies and divides step by step instead of using full factorials, which keeps larger inputs workable, but very large results lose exact precision because they are held as decimal numbers.

Worked example

An ice cream shop has n = 5 flavours and you pick r = 3 scoops, repeats allowed, order ignored. Substitute: C(5 + 3 − 1, 3) = C(7, 3). Then 7! / (3! × 4!) = (7 × 6 × 5) / (3 × 2 × 1) = 210 / 6 = 35. So there are 35 different combinations of three scoops.

Try this example →

Common mistakes

  • Using the ordinary combinations formula C(n, r), which forbids repeats. Here C(5, 3) would give 10, not 35.
  • Using it when order matters. A sequence like vanilla then mint differs from mint then vanilla, and that needs nr instead.
  • Swapping n and r. n is the number of types available, r is how many you pick.
  • Entering the total number of physical items instead of the number of distinct types.
  • Using it when each type has a limited stock; the formula assumes unlimited copies of every type.

About this calculator

This calculator counts combinations with repetition (also called multiset coefficients) — the number of ways to choose r items from n types when repeats are allowed and order doesn't matter — using the formula C(n+r−1, r) = (n+r−1)! / (r!·(n−1)!). The formula comes from the “stars and bars” technique: representing each selection as a row of r stars split into n groups by n−1 bars, which turns the counting problem into an ordinary combination C(n+r−1, r).

Students and instructors in combinatorics and discrete math courses use it to work through classic examples like choosing r scoops from n ice cream flavors with repeats allowed, or distributing identical objects into distinguishable bins; computer scientists use the same math to count multisets and evaluate generating functions; and statisticians use it when analyzing sampling schemes done with replacement. Enter the number of types (n) and the number chosen (r) to get the count.

Was this helpful?

You can pick up to 3 reactions.

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators