Combinations with Repetition Calculator - C(n+k-1, k) Formula

    How many ways can you choose k items from n types when repetition is allowed and order does not matter? Get the result using the formula C(n+k-1, k) with a side-by-side comparison to standard combinations.

    Parameters

    Enter data for calculations

    How many distinct types of elements you are choosing from.

    How many elements you pick for your set (repetition allowed).

    Form progress0 / 2 fields

    💡 Fill in all required fields to unlock the calculate button

    Five ice cream flavors, three scoops, repeats allowed - how many options?

    You walk into an ice cream shop with 5 flavors and order 3 scoops. You can pick the same flavor more than once, and nobody cares about the order on the cone. Chocolate-chocolate-vanilla is the same selection as vanilla-chocolate-chocolate. How many distinct combinations exist? The answer is 35, and you get it from the formula C(n+k-1, k). This calculator does the arithmetic for you and compares the result with standard combinations (no repeats) so you can see exactly how much repetition expands the count.

    Try it now
    Set n = 5 (flavors), k = 3 (scoops). Click Calculate.
    Result: 35 combinations with repetition vs. only 10 without repetition.
    Allowing repeats multiplied the options by 3.5.

    When does this formula apply?

    Use combinations with repetition whenever you pick k items from n types, repetition is allowed, and order does not matter. The technical term is a multiset of size k from a set of n types. The formula is C(n+k-1, k) = (n+k-1)! / (k! (n-1)!). It is sometimes written with double parentheses as ((n choose k)).

    Scenario n k C(n+k-1, k) C(n, k) no rep.
    3 scoops from 5 flavors 5 3 35 10
    2 dice (unordered result) 6 2 21 15
    10 candies among 4 kids 4 10 286 0 (k>n)
    5 coins from 4 denominations 4 5 56 0 (k>n)
    Quadratic in 3 variables 3 2 6 3

    The four counting methods side by side

    Combinatorics has four fundamental counting formulas depending on two questions: does order matter, and is repetition allowed?

    Method Formula Order? Repetition?
    Combination C(n, k) = n! / (k!(n-k)!) No No
    Combination with rep. C(n+k-1, k) No Yes
    Permutation P(n, k) = n! / (n-k)! Yes No
    Variation with rep. n^k Yes Yes

    Stars and bars: the intuition behind the formula

    Picture k identical stars and (n-1) dividers arranged in a row. Each arrangement maps to exactly one multiset. With 3 types and 4 items:

    • **|*|* = 2 of type A, 1 of type B, 1 of type C
    • ****|| = 4 of type A, 0 of type B, 0 of type C
    • |**|** = 0 of type A, 2 of type B, 2 of type C

    Total symbols: k + (n-1). Choose k positions for stars out of k + n - 1 total positions: that gives C(n+k-1, k). This bijection between multisets and star-bar strings is why the formula works.

    Worked examples

    Distributing identical items
    Hand out 10 identical candies to 4 children (each can get zero or more). Here n = 4, k = 10. C(13, 10) = C(13, 3) = 286 ways. Without repetition: impossible (k > n), which makes sense because you cannot give each child at most one candy when there are 10 candies and only 4 kids.
    Rolling two dice (unordered)
    Two dice land. You only care about the set of values, not which die shows which. n = 6 faces, k = 2 dice. C(7, 2) = 21 distinct unordered outcomes. For comparison, there are 36 ordered outcomes (6 x 6), but many are duplicates when order is ignored.
    Polynomial terms
    A polynomial of degree d in n variables has C(n+d-1, d) distinct terms. A quadratic (d=2) in 3 variables (x, y, z) has C(4, 2) = 6 terms: x2, y2, z2, xy, xz, yz. A cubic in 4 variables has C(6, 3) = 20 terms.
    Shopping basket
    A store sells 8 types of fruit. You want to buy exactly 4 pieces, and you may buy multiple of the same type. C(11, 4) = 330 possible baskets. Without repetition you could only make C(8, 4) = 70 baskets.
    Large-scale example
    Choose 20 items from 50 types with repetition: C(69, 20) = 7,886,597,962,249,166 (nearly 8 quadrillion). Without repetition: C(50, 20) = 47,129,212,243,960, about 167 times fewer. Repetition has a massive multiplying effect when k is large relative to n.

    Common questions

    Can k be larger than n?
    Yes. With repetition, k can exceed n because the same type can be picked multiple times. C(n+k-1, k) is always defined and positive for n >= 1 and k >= 1. Without repetition, C(n, k) = 0 when k > n because you cannot choose more distinct items than are available.
    What is the difference between combinations and variations with repetition?
    Combinations with repetition ignore order (choosing A-B-A is the same as B-A-A). Variations with repetition (n^k) count order (A-B-A and B-A-A are different sequences). Use combinations when you care only about which items are chosen, and variations when the arrangement matters, like PIN codes or passwords.
    What is a multiset coefficient?
    A multiset coefficient, written ((n choose k)) with double parentheses, is another name for combinations with repetition. It equals C(n+k-1, k). The name reflects the fact that you are counting multisets: sets that allow duplicate elements.
    Why does the stars and bars method work?
    Stars and bars creates a one-to-one mapping (bijection) between multisets and binary strings of stars and bars. Every multiset of k items from n types corresponds to exactly one arrangement of k stars and (n-1) bars, and vice versa. Because the mapping is bijective, counting the arrangements gives the same number as counting the multisets. The count is C(n+k-1, k) because you choose which k of the n+k-1 total positions are stars.
    How large can n and k be in this calculator?
    The calculator supports n up to 1000 and k up to 200. For very large inputs, the result may exceed JavaScript safe integer range (about 9 x 10^15), in which case it is displayed in scientific notation. The iterative multiplication method used here minimizes intermediate overflow.
    Where do combinations with repetition appear in real life?
    They appear whenever you distribute identical objects into distinct categories: assigning tasks to teams, splitting money among accounts, counting monomials in algebra, modeling chemical compositions, and choosing toppings at a restaurant. Any problem that says "how many ways to distribute k identical items into n distinct bins" is a multiset problem solved by C(n+k-1, k).

    Related tools

    Combinations & Permutations Calculator

    Calculate standard combinations C(n,k) and permutations P(n,k) without repetition - Open calculator

    Variations with Repetition Calculator

    Compute n^k for ordered selections with replacement - Open calculator

    Factorial Calculator

    Calculate n! with step-by-step breakdown and digit count - Open calculator

    Probability Calculator

    Calculate probabilities for single and compound events - Open calculator

    Prime Factorization Calculator

    Break any integer into its prime factors - Open calculator

    Similar calculators from this section