Combinations with Repetition Calculator

Calculate multiset combinations C(n+r-1, r). Stars and bars visualization, full enumeration for small cases, distribution patterns, and reference tables.

Combinations with Repetition Calculator

How many types/categories to choose from
How many items to select (repetition allowed)
Combinations (with rep)
35
C(5+3−1, 3) = C(7, 3)
Formula
C(7, 3)
(n+r−1)! / (r! × (n−1)!)
Without Repetition
10
C(5, 3) for comparison
Ratio
3.50×
With rep / without rep
n (types)
5
Number of distinct types
r (chosen)
3
Number of items selected

Stars and Bars Interpretation

Distributing 3 identical items among 5 distinct bins is equivalent to arranging 3 stars (★) and 4 bars (|) in a line:

★ ★ ★ | | | |

Total arrangements = C(3 + 4, 4) = C(7, 3)

All 35 Combinations

{1, 1, 1}{1, 1, 2}{1, 1, 3}{1, 1, 4}{1, 1, 5}{1, 2, 2}{1, 2, 3}{1, 2, 4}{1, 2, 5}{1, 3, 3}{1, 3, 4}{1, 3, 5}{1, 4, 4}{1, 4, 5}{1, 5, 5}{2, 2, 2}{2, 2, 3}{2, 2, 4}{2, 2, 5}{2, 3, 3}{2, 3, 4}{2, 3, 5}{2, 4, 4}{2, 4, 5}{2, 5, 5}{3, 3, 3}{3, 3, 4}{3, 3, 5}{3, 4, 4}{3, 4, 5}{3, 5, 5}{4, 4, 4}{4, 4, 5}{4, 5, 5}{5, 5, 5}

Distribution Patterns

Pattern (items per type)Count% of Total
2,12057.1%
1,1,11028.6%
3514.3%

Reference Table: C(n+r−1, r)

n \ r12345
111111
223456
336101521
4410203556
55153570126
662156126252
772884210462
8836120330792
Planning notes, formulas, and examples

About the Combinations with Repetition Calculator

Combinations with repetition (multiset coefficients) count the number of ways to choose r items from n types when each type can be selected multiple times and order doesn't matter. The formula is C(n+r−1, r) = (n+r−1)! / (r!(n−1)!), also written as ((n multichoose r)).

This is equivalent to the "stars and bars" problem: distributing r identical objects into n distinct bins. The calculator visualizes this interpretation, enumerates all combinations for small cases, and shows the distribution patterns of how items spread across types.

Common applications include selecting scoops of ice cream (same flavor allowed), distributing identical tasks among workers, counting non-negative integer solutions to equations, and polynomial coefficient counting. That makes the tool useful both for classroom combinatorics and for practical counting problems where repeats are allowed but order is irrelevant. It is also a quick way to connect an abstract formula to real allocation problems that would be tedious to count by hand.

When This Page Helps

Combinations with repetition are less intuitive than standard combinations but appear in many real problems. It gives the stars-and-bars visualization, full enumeration for small cases, comparison with without-repetition counts, and a reference table for quick lookups. It is useful when you need to show not just the final count, but why repeated selections change the counting logic.

How to Use the Inputs

  1. Enter n (number of types or categories to choose from).
  2. Enter r (number of items to select, repetition allowed).
  3. Or click a preset for common examples.
  4. Review the count and the stars-and-bars representation.
  5. For small cases, examine all enumerated combinations.
  6. Check distribution patterns to see how items spread across types.
  7. Use the reference table for nearby values.
Formula used
Combinations with Repetition: C(n+r−1, r) = (n+r−1)! / (r! × (n−1)!) Also called the multiset coefficient ((n multichoose r)). Equivalent to: - Number of ways to place r identical balls in n distinct bins - Number of non-negative integer solutions to x₁+x₂+...+xₙ = r - Coefficient count in (n+r−1)-choose-r lattice paths

Example Calculation

Result: C(7,3) = 35

Choosing 3 items from 5 types with repetition: C(5+3−1, 3) = C(7, 3) = 35. Without repetition it would be C(5,3) = 10, so repetition allows 3.5× more combinations. Example: choosing 3 scoops from 5 ice cream flavors.

Tips & Best Practices

  • Think of it as distributing r identical items among n distinct bins (stars and bars).
  • When r ≫ n, most combinations have many repeated items. When r ≪ n, most look like standard combinations.
  • C(n+r−1, r) = C(n+r−1, n−1) — choosing where to place r items among n bins is equivalent to choosing n−1 dividers.
  • For n = 2, C(r+1, r) = r+1 (pairs like (0,r), (1,r−1), ...).
  • The multiset coefficient grows more slowly than the permutation-with-repetition count (nʳ), since order doesn't matter.
  • This formula also counts the number of monomials of degree r in n variables.

Stars and Bars: A Powerful Counting Technique

The stars and bars (also called balls and urns) method transforms a distribution problem into a sequence-counting problem. To distribute r identical items among n groups, imagine r stars (★) and n−1 bars (|) arranged in a row. Each arrangement uniquely represents a distribution. The total is C(r+n−1, n−1) = C(n+r−1, r).

Connection to Integer Partitions

Combinations with repetition are closely related to weak compositions of integers. C(n+r−1, r) counts the number of ways to write r as an ordered sum of n non-negative integers. For unordered sums (integer partitions), the counting is more complex and doesn't have a simple closed-form formula.

Practical Applications Beyond Textbooks

In inventory management, C(n+r−1, r) counts the number of distinct orders of r items from n suppliers. In genetics, it counts genotype possibilities with multiple alleles. In finance, it counts the number of ways to allocate a fixed budget across n investment categories in fixed increments.

Sources & Methodology

Last updated:

Frequently Asked Questions

  • Without repetition, each item can be chosen at most once: C(n,r). With repetition, items can be reused: C(n+r−1,r). With repetition always gives at least as many combinations, and often many more.