Given $n$ digits $x_1,...,x_n.$ I would like to understand how many $n$-digit numbers I can form from this set of digits.

I would like to emphasize that I can pick each digit only once, so $x_1 x_1 ... x_1$ is not allowed.

But if $x_1$ and $x_2$ are the same digit, then of course both $x_1$ and $x_2$ must appear in the number.

A simple example

Let $x_1=1$ and $x_2=2$ then $12$ and $21$ are the only numbers.

However, if $x_1=x_2=1$ then $11$ is the only number.

Is there a general formula for the number of numbers for a given set of digits?


1 Answer 1


Ignoring the issue of leading zeroes, the multinomial coefficient gives the answer to the number of possible distinct strings from arranging a multiset of characters.

To avoid leading zeros, calculate the result for each possible non-zero choice of first character.

So for an example without zeroes, arranging the digits "$111255668889$" has $\binom{12}{3,1,2,2,3,1} = \binom{12}{3,3,2,2,1,1}$ $= \frac{12!}{3!3!2!2!}$ $= 3326400$ options


You must log in to answer this question.