keisoku

Combination with Repetition (nHr)

Count how many ways to choose r items from n types when repetition is allowed and order does not matter.

Input

Count the ways to choose r items from n types when repetition is allowed (combination with repetition nHr).

How many distinct types to choose from (1 or more)

How many to pick, repeats allowed (0 or more)

Result

Ways to choose 3 from 5 types with repetition

35

nHr = 5H3 = (7)C3

Plain combination 5C3

10


The combination with repetition nHr equals the binomial of n plus r minus 1 choose r, matching the stars and bars arrangement.

How it works

  • A combination with repetition nHr counts the ways to choose r items from n types when repeats are allowed and order does not matter.
  • The formula is nHr equal to the binomial coefficient of n plus r minus 1 choose r, often called the stars and bars method.
  • Example: choosing 2 sweets from 3 kinds with repetition allowed gives 3H2 equal to 4 choose 2, which is 6 ways.
  • The plain combination nCr counts choices without repetition and is defined only when r is at most n.
  • Large results stay exact because the values are computed with integer big-number arithmetic.

Reviews

Tell us what you think of this calculator.

Write a review

  1. Home
  2. Combination with Repetition (nHr)