This problem comes from the Lovasz Combinatorial Problems and Exercises book. I'm left rather confused for the second half of the second problem. It asks: We have $k$ distinct postcards and want to send them all to our $n$ friends (a friend can get any number of postcards, including 0). How many ways can this be done? What happens if we want to send at least one card to each friend?
The first half is rather simple, however, the second half has me puzzled. This is equivalent to counting the number of surjections yes? However, the answer in the back of the book is $\binom{k}{n}*n!$.
My reasoning gives me that the number of ways to do this would be:
$$n^k-\sum_{i=1}^{n}\binom{n}{i}(n-i)^{k}$$
(something like that I'm typing in a bit of a rush so forgive a mistake if there is one).
But my reasoning is that you count the number of ways to send out the postcards in any manner, and subtract out the ones where you miss some group of $i$ friends. I can't see my error or how my answer is related to the books.
I think you meant $$\sum_{i=0}^n(-1)^i\binom{n}{i}(n-i)^k$$
And what the book meant was using Stirling numbers of the second kind, viz $${k\brace n}n!$$