[Math] Number of distinct combination with duplicates from a fixed set of elements

combinationscombinatorics

I have a fixed set of $N$ elements

$$\{a_i\}, i = 1, \ldots, N$$

And I am looking for the number of distinct possible combinations of n items I can create from this list (allowing duplicates elements) such as:

$$\{a_{j_k}\}, 1 <= j_1 <= j_2 \ldots <= j_n <= N$$

For example, if we assume $N = 1$ and $n = 3$ then only combination is:

$$\{a_1,a_1,a_1\}$$

And answer is one.

If $N = 2$ and $n = 3$ then all possible combinations are:

$$\{a_1,a_1,a_1\}$$
$$\{a_1,a_1,a_2\}$$
$$\{a_1,a_2,a_2\}$$
$$\{a_2,a_2,a_2\}$$

And answer is $4$.

etc…

Ideally I am looking for a closed form if one exists as I am looking to get some figures for large $n$ and $N$

Best Answer

The classical formula for this is $${N + n - 1 \choose n},$$ see for example here.

Related Question