The number of sequences of length n from the set of K elements, so that each element occurs in the sequence

271 Views Asked by At

Number of combinations to make a sequence of length $N$ using set of $K \leq N$ elements so that each element occurs at least one time.

For example with set ${1, 2}$ and $N = 3$ all possibilities are:

  • (1, 1, 2)
  • (1, 2, 1)
  • (1, 2, 2)
  • (2, 1, 1)
  • (2, 1, 2)
  • (2, 2, 1)

What equals to: $\binom32\binom11 + \binom11\binom32$

Is there any way to get expression for number of combinations through $N$ and $K$?

1

There are 1 best solutions below

0
On BEST ANSWER

Starting with the combinatorial class

$$\def\textsc#1{\dosc#1\csod} \def\dosc#1#2\csod{{\rm #1{\small #2}}} \textsc{SEQ}_{=K}(\textsc{SET}_{\ge 1}(\mathcal{Z}))$$

we get the generating function

$$G(z) = (\exp(z)-1)^K$$

with the closed form using Stirling numbers

$$N! [z^N] (\exp(z)-1)^K = N! [z^N] K! \frac{(\exp(z)-1)^K}{K!} = K! {N\brace K}.$$