Roboculator
Online CalculatorsCategoriesDate & EventsNews
Get Started
Online CalculatorsCategoriesDate & EventsNewsGet Started
Roboculator

Smart calculators for every challenge. Free, fast, and private.

Categories

  • Finance
  • Health
  • Math
  • Construction
  • Conversion
  • Everyday Life

Popular Tools

  • Date & Events
  • Loan Calculator
  • BMI Calculator
  • Percentage Calc
  • Latest News
  • Search All

Resources

  • Glossary
  • Topic Tags
  • News & Insights

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Service
  • Editorial Policy
  • Disclaimer
© 2026 Roboculator. All rights reserved.
Roboculator

roboculator.com

  1. Home
  2. /Statistics
  3. /Probability Calculators
  4. /Combinations with Replacement Calculator

Combinations with Replacement Calculator

Calculator

Results

Combinations with Replacement

35

log10(Result)

1.54407

Total Items in Top Term (n + r - 1)

7

Results

Combinations with Replacement

35

log10(Result)

1.54407

Total Items in Top Term (n + r - 1)

7

The Combinations with Replacement Calculator computes the number of ways to choose r items from n types when repetition is allowed and order does not matter. Also known as multiset coefficients or "stars and bars" combinations, this formula answers questions like: "How many ways can you choose 3 scoops from 5 ice cream flavors?" or "How many ways can 10 identical balls be placed in 4 distinct boxes?"

Unlike standard combinations where each item can only be selected once, combinations with replacement allow the same item to be chosen multiple times, vastly expanding the number of possible selections. This concept appears in inventory planning, polynomial expansion, and statistical sampling with replacement.

Visual Analysis

How It Works

The number of combinations with replacement is given by:

$$\binom{n+r-1}{r} = \frac{(n+r-1)!}{r!(n-1)!}$$

This formula is derived from the stars and bars theorem in combinatorics. Imagine r identical stars (items to choose) and (n-1) bars (dividers between types). Any arrangement of these stars and bars represents a valid selection. The total number of symbols is r + (n-1) = n + r - 1, and we need to choose positions for either the r stars or the (n-1) bars.

For example, with n = 3 types and r = 4 selections, we arrange 4 stars and 2 bars. The arrangement ★★|★|★ means 2 of type 1, 1 of type 2, 1 of type 3. The arrangement ||★★★★ means 0 of type 1, 0 of type 2, 4 of type 3. The total number of such arrangements is C(6, 4) = C(6, 2) = 15.

Like standard combinations, this calculator uses the log-gamma function for numerical stability:

$$\ln \binom{n+r-1}{r} = \ln \Gamma(n+r) - \ln \Gamma(r+1) - \ln \Gamma(n)$$

The formula can also be written as C(n+r-1, n-1), highlighting the symmetry: choosing items is equivalent to placing dividers.

Understanding Your Results

The result indicates how many distinct multisets of size r can be formed from n types. Each multiset is unordered and allows repeats. The count grows polynomially in r for fixed n, and combinatorially in both n and r. For large values, the log₁₀ output provides a sense of scale.

Worked Examples

Ice Cream: 3 Scoops from 5 Flavors

Inputs

n5
r3

Results

combinations35
log combinations1.5441

Choosing 3 scoops from 5 flavors with repeats allowed: C(5+3-1, 3) = C(7, 3) = 35 possible combinations. This includes choices like {vanilla, vanilla, chocolate} or {strawberry, mint, mint}. Without replacement, there would be only C(5,3) = 10 options.

Distributing 8 Identical Balls into 4 Boxes

Inputs

n4
r8

Results

combinations165
log combinations2.2175

Placing 8 identical balls into 4 distinct boxes is equivalent to choosing 8 items from 4 types with replacement: C(4+8-1, 8) = C(11, 8) = 165 distributions. Examples include (8,0,0,0), (2,2,2,2), or (5,1,1,1).

Frequently Asked Questions

Stars and bars is a combinatorial technique for counting the ways to distribute r identical objects into n distinct bins (or equivalently, choosing r items from n types with replacement). Represent objects as stars (★) and bin separators as bars (|). Each arrangement of r stars and (n-1) bars gives a unique distribution. The total arrangements equal C(n+r-1, r). For example, distributing 3 candies among 2 children: ★★|★ means child 1 gets 2, child 2 gets 1. There are C(4,3) = 4 ways total.

Standard combinations C(n, r) select r items from n without replacement — each item is chosen at most once, and r cannot exceed n. Combinations with replacement allow items to be selected multiple times, so r can be any non-negative integer regardless of n. The formulas are different: C(n, r) = n!/(r!(n-r)!) versus C(n+r-1, r) = (n+r-1)!/(r!(n-1)!). Replacement always gives equal or more combinations for the same n and r.

Common applications include: (1) Sampling with replacement — drawing balls from a bag, replacing each before the next draw; (2) Resource allocation — distributing identical resources among departments; (3) Polynomial expansion — the number of monomials of degree r in n variables equals C(n+r-1, r); (4) Inventory planning — selecting r items to stock from n product types where repeats are needed; (5) Dice probabilities — unordered results of rolling r identical dice with n faces.

If r = 0, there is exactly 1 way to choose nothing: the empty selection, so C(n-1, 0) = 1. If n = 0 and r > 0, there are no types to choose from, so the result is 0. If both are 0, the result is 1 by convention. This calculator requires n ≥ 1 since having zero types to choose from is degenerate.

A multiset (or bag) is a generalization of a set that allows repeated elements. While the set {a, b} = {b, a} and cannot contain duplicates, the multiset {a, a, b} is valid and different from {a, b, b}. The number of distinct multisets of size r from n types is exactly C(n+r-1, r). Multisets appear in algebra (symmetric polynomials), computer science (hash-based data structures), and chemistry (molecular formulas as multisets of atoms).

The generalized binomial theorem for the expansion of (x₁ + x₂ + ... + xₙ)^r involves multiset coefficients. The number of terms in the expansion equals C(n+r-1, r), which is precisely the number of multisets of size r from n types. Each term corresponds to a unique multiset of variable indices. For n = 2, this reduces to the standard binomial theorem with C(r+1, r) = r+1 terms.

Sources & Methodology

Brualdi, R.A. (2010). Introductory Combinatorics (5th ed.). Pearson. Stanley, R.P. (2012). Enumerative Combinatorics (2nd ed.). Cambridge University Press. Feller, W. (1968). An Introduction to Probability Theory and Its Applications, Vol. I (3rd ed.). Wiley.
R

Roboculator Team

The Roboculator Team explains calculations, planning tools, and practical formulas in clear language for real-life situations.

How helpful was this calculator?

Be the first to rate!

Related Calculators

Lottery Odds Calculator

Probability Calculators

Probability Calculator

Probability Calculators

Conditional Probability Calculator

Probability Calculators

Monty Hall Problem Calculator

Probability Calculators

Combinations Calculator (nCr)

Probability Calculators

Permutations Calculator (nPr)

Probability Calculators