# How many different numbers are composed by n repeated digits?

For example, there are 3 digits: 1, 1, 4 and they compose 3 different numbers: 114, 141, 411. My questions is: given n repeated digits: 1 * n1, 2 * n2, 3 * n3, ..., 9 * n9, in which ni >= 0 and n1 + n2 + ... + n9 = n, how many different numbers are composed by the n digits?

-
Numbers and digit strings are distinguished by the fact that one won't accept numbers with leading zeros. Which do you mean? Both can be handled, but digit strings are easier because there is not a distinguished element. It is amazing how much harder that makes things. – Ross Millikan Jun 18 '13 at 3:53
Only 1 ~ 9 are valid digits, 0 is not included in my question. – Robert Jun 18 '13 at 5:34

Usually, the easiest way to answer these questions is to think as follows:

1) Suppose that we can tell ALL of the objects apart. (For instance, say we numbers the 1's as $1_1,1_2,\ldots,1_{n_1}$, etc.). How many ways could these be arranged? In this case, that is just $n!$, of course.

2) Obviously this was an overcounting. But by how much? In other words, how many rearrangements of the "labeled" objects should all count as the same "unlabeled" object? Given a sequence, you can rearrange the 1's in any way you like, as long as the positions that have 1's don't change; since there are $n_1$ 1's, this can be done in $n_1!$ ways. Similarly for the rest.

So, overall, there are $$\frac{n!}{n_1!n_2!\cdots n_9!}=\binom{n}{n_1,\ldots,n_9},$$ where this last is the multinomial coefficient.

-

I take it you are asking about numbers that use all the available digits. If you are familiar with Multinomial Coefficients, the answer is immediate: By definition the number of choices is $$\binom{n}{n_1,n_2,\dots, n_9}.$$ This is equal to $$\frac{n!}{n_1!n_2!n_3!\cdots n_9!}.$$

-
Thank you Andre! I would like to mark both you and nrpeterson's answers as accepted but I'm only allowed to do one:( As nrpeterson's explanation is easier for me, I give that to him. – Robert Jun 18 '13 at 5:46
I think it is better too. – André Nicolas Jun 18 '13 at 5:49

First you pick the positions for the $n_1$ digits in ${n \choose n_1}$ ways, then you pick the positions fo the $n_2$ digits in ${n-n_1 \choose n_2}$ ways and so on. Multiply them and you are there.

-