How many sequences of digits of length 11 exist such that each of them contains all digits (from 0 to 9)

combinatoricspermutations

To make condition true let’s take 10 digits of a sequence (I will call them “first” later in post) and we will choose digit on each position such that there will be all digits from 0 to 9, it can be done in $10!$ ways (on first we can put all 10 available digits, on second 9 (without the one that we have already used) an so on).

On the eleventh position we can put any of 10 digits.

Also you might notice that these “first” 10 digits can be chosen in 11 ways (${11 \choose 10}$)

Naive answer would be $10!\cdot {11 \choose 10} \cdot 10$

But it’s easy to see that we are overcounting (for example let’s say that we have chosen first ten elements of the sequence as “first” elements and let’s also say that currently we have such a sequence: 0123456789 9 (space is made to differentiate “first” elements and one element where we can put any digit). We can get absolutely the same sequence in case when we choose “first” elements as first nine elements of the sequence and the last element of a sequence, one of possible sequences is 012345678 9 9. It is obvious that sequences that we got in first and in second situations are the same, but how to prevent this double counting?)

Best Answer

Each sequence is counted exactly twice, so you can just take the naive answer and divide it by $2$.

Or you could introduce a rule that says you can only add the second occurrence of a digit after the place of its first occurrence, not before. Then for each of the $10!$ permutations there is $1$ sequence where the final digit is repeated; $2$ sequences where the last but one digit is repeated etc., giving a total of

$\displaystyle 10! \sum_{n=1}^{10} n = 55 \times 10!$

Related Question