Counting "mulstisets" on a given sequence.

58 Views Asked by At

So, i have the following problem:

Let $a_1, a_2, a_3, ..., a_n$ be an integer sequence. How many distinct sequences of size $1$ to $n$ can you make from $a$, given for each element $a_i$, there are $f_{a_i}$ elements equal to it on sequence $a$.

Note: The elements in the sequences need to be in the order they appear in sequence a.

Example: if $a = (1, 1, 2)$, the answer is $4$ (namely, $(1), (1, 1), (1, 2)$ and $(2)$).

So far i've attempted to work with some repeated permutations formulas, but i can't figure out a way to do it.

1

There are 1 best solutions below

0
On

If your initial multiset has $f_1$ copies of $1$, $f_2$ copies of $2$, etc. then the number of distinct multisets of $$\prod_{i \in \mathbb{N}} (1 + f_i)$$ However, if you want to exclude the original multiset and the empty multiset you must then subtract $2$.