Note: I tried asking this on math.stackexchange (here), but didn't really receive an answer - so I figured this might be the right place.

How can I find the number of *k*-permutations of *n* objects, where there are *x* types of objects, and r_{1}, r_{2}, r_{3} ... r_{x} give the number of each type of object?

Example:

I have 20 letters from the alphabet. There are some duplicates - 4 of them are

a, 5 of them areb, 8 of them arec, and 3 ared. How many unique 15-letter permutations can I make?

In the example:

n = 20

k = 15

x = 4

r_{1} = 4, r_{2} = 5, r_{3} = 8, r_{4} = 3

Furthermore, if there isn't a straightforward solution: how efficiently can this problem be solved?