Part of the Math & Statistics suite · 235 calculators

Combinations with Repetition Calculator

How many ways to choose r items from n types when you may take the same type more than once and order does not matter — the doughnut-box problem.

Choosing a dozen doughnuts from six varieties is not C(6, 12) — you can repeat, and there are more than six choices.

Results update as you type
Results
Selections with repetition
6,188
Without repetition C(n, r)
If order also mattered (nʳ)
Stars and bars: choose r from
With at least one of every type
Reviewed September 2026. Pure mathematics: the result does not depend on where you are. Terminology follows US usage (math, parentheses, decimal point).
No account required · Google Analytics off unless allowedCalculator arithmetic runs in your browserResults update as you type
All calculations run 100% in your browser. The calculator code does not submit your figures to GlobalCalc to obtain a result.
About combinations with repetition

How the combinations with repetition calculator works

Choosing a dozen doughnuts from six varieties is not C(6, 12) — you can repeat, and there are more than six choices. The trick, called stars and bars, is to line up r stars and n − 1 dividers: every arrangement is one selection, so the count is C(n + r − 1, r).

This is the standard model for distributing identical objects into distinct boxes.

Formula: C(n + r − 1, r) = (n + r − 1)! / (r! (n − 1)!)

Worked examples

InputsSelections with repetitionNote
A dozen doughnuts from 6 varieties6,1886,188
3 scoops from 10 flavours220220
5 dice — how many distinct results?252252

Frequently asked questions

What is the doughnut problem?

Choosing a dozen doughnuts from six varieties. Repeats are allowed and the box order does not matter, so the answer is C(17, 12) = 6,188.

What is stars and bars?

A way of turning the problem into a plain combination: r stars for the items and n − 1 bars to split them between types.

How is this different from nCr?

nCr forbids repeats, so it needs r ≤ n. This version allows any r.

What if I need at least one of each?

Give one of each away first, then distribute the remainder: C(r − 1, n − 1).

Where else does this appear?

Anywhere identical things go into distinct bins — allocating budget across departments, counting monomials, distributing sweets.

Where these figures come from

Last checked: September 2026. Formulas are fixed by mathematics and do not change with tax years or regulations.