How to count with repetition
When the same item may be chosen more than once, two different counts apply. If order matters you want permutations with repetition, which equal n^r. Picking two scoops from three flavors gives 3² = 9 outcomes if (strawberry, banana) differs from (banana, strawberry). If order does not matter you want combinations with repetition, C(n+r−1, r), which gives 6.
That second formula looks odd until you see the stars-and-bars argument behind it. Lining up r items and n−1 dividers is the same problem, so you are choosing which r of the n+r−1 positions hold items. That is why a multiset count is a combination, not a permutation. Because the two are easy to mix up, both formulas are printed with the results.
When r is 0 there is exactly one way to pick nothing, so both counts are 1. r may exceed n as long as repeats are allowed; the no-repetition counts are then 0, so those reference rows are hidden and a note appears instead. n must be 1 or more and r must be 0 or more.
These counts grow fast enough to break ordinary floating point arithmetic. This calculator uses exact BigInt integer arithmetic, so a value such as 50^50, which has 85 digits, is printed exactly. Above 16 digits a scientific-notation form is shown as well for readability. The supported range is n ≤ 50 and r ≤ 50.
Frequently asked questions
If order matters the count is n^r, permutations with repetition. If order does not matter it is C(n+r−1, r), combinations with repetition. The same n and r give different answers.
The problem is equivalent to arranging r items and n−1 dividers in a row, so you choose the r item positions out of n+r−1 total positions.
Yes, when repeats are allowed. The no-repetition counts are 0 in that case because there are not enough distinct items, so those reference values are not shown.