0

How many different sequences/strings of length $\ell$ contain exactly $k$ (out of $n$) different elements?

Or, to put it differently, how many functions from $\{1,\dots,\ell\}$ to $\{1,\ldots,n\}$ have the property that their image is of size exactly $k$?

Fibonacci
  • 423

1 Answers1

1

First choose the $k$ elements, in $\binom{n}{k}$ ways, then count the number of surjective functions from $\{1,\dotsc, \ell\}$ to those $k$ elements, in $k!S(\ell,k)$ ways (see here).

rogerl
  • 22,707