Is there any closed form expression for the number of combinations with repetitions removing the permutated sequences (for a given number of spaces (N1) and a given number of possible numbers (N2))?
For example in this case there are 5 spaces and 4 possible numbers:
1 1 1 1 1 -> Valid
1 1 1 1 2 -> Valid
1 2 1 1 1 -> This one is a repetition of the above line
1 2 4 4 1 -> Valid
1 4 1 4 2 -> This one is a repetition of the above line
1 2 3 4 4 -> Valid
It does not matter getting the sequence 1 2 4 4 1 or de 1 4 1 4 2 in the end. But it is not possible to get both of them.
Is this a known problem? Is there any elegant algorithm or closed form expression to solve this problem?
Thanks!
Suppose there are $r$ spaces, and $n$ possible numbers $1,...,n$.
Counting only one instance for sequences which permute to each other, each sequence of $r$ terms, where each term is one of the numbers $1,..,n$, corresponds to a solution $(x_1,...,x_n)$ of the equation $$x_1 + \cdots + x_n = r$$ where each $x_k$ is a nonnegative integer representing the multiplicity of the number $k$ in the given sequence.
By the stars-and-bars formula, the desired count is $$\binom{r+n-1}{n-1}$$ For example, if $r=5,\;n=4$, we get a count of $$\binom{5+4-1}{4-1}=\binom{8}{3}=56$$ To illustrate the correspondence, note that the sequence $$(1,1,3,4,4)$$ is the unique sequence (up to a permutation of the terms) with
corresponding to the solution $$(x_1,x_2,x_3,x_4)=(2,0,1,2)$$ of the equation $$x_1+x_2 + x_3 + x_4 = 5$$