What's the name of $\sum_{k = 0}^{n} (-1)^k {n \choose k} (n-k)^w$?

60 Views Asked by At

I worked out the following expression as the number of all possible "words" consisting of exactly $w$ letters from an alphabet $L$ of size $\left|L\right| = n \leq w$, and containing each of these $n$ letters at least once:

$$\sum_{k = 0}^{n} (-1)^k {n \choose k} (n-k)^w$$

I've seen similar alternating formulas before, in which every new term corresponds to a correction for the over-counting resulting from overlaps among the sets counted by the previous term.

I don't think I've seen this particular sum, though, which makes me wonder if there's a generalized counting theorem that produces such alternating sums.

Be that as it may, I have not managed to find the right keywords for searching more information about the formula above (generalizations, fast algorithms for generating all the admissible words, etc.), or for the hypothetical counting theorem that would have it as a special case. I'm looking for pointers.