Permutations with repetition

The permutations with repetition of $$n$$ elements in which the first element recurs $$n_1$$ times, the second $$n_2$$ times... and the last one repeats itself $$n_r$$ times, the different groups are of nelements that can be formed so that in every group, every element appears the stated number of times. Also, two groups differ only in the order of placement. It is represented by $$P_n^{n_1, \ldots, n_r}$$.

To know how many permutations with repetition of $$n$$ elements, in which the first element recurs $$n_1$$ times, the second $$n_2$$ times... and the last one repeats itself $$n_r$$ times, we use the following formula: $$$\displaystyle P_n^{n_1, \ldots, n_r}=\frac{n!}{n_1! \ldots n_r!}$$$ To understand it better, let's consider the following example:

We want to know how many five-figure numbers there are in which 2 appears only once, while 7 and 9 both appear twice. In this case: $$n = 5$$, $$n_1= 1,n_2 = 2$$ and $$n_3 = 2$$.

Some possibilities are: $$27799, 72799, 92977, 92779, 77992, 72979$$... but there are many others, and to find them all would take a long time.

Nevertheless, by means of the previous formula we can quickly learn that the number of possibilities is 30: $$$\displaystyle P_5^{1,2,2}=\frac{5!}{1!2!2!}$$$