How many distinct $6$ digit numbers are there in which all of the digits $1$ to $5$ appear?

1.4k Views Asked by At

enter image description here

For part (i), I think it's just $6!$.

(ii), I think if we treat $\texttt{123}$ as a block, then we should have 4 slots intead of 6 slots now, so the answer should be $4!$.

(iii) $\frac{6!}{2}$ - this should also be correct.

(iv) -not sure what do to- need help and explanation. I did some programming and checked one by one, and if my code is correct, the answer is 5280?

2

There are 2 best solutions below

0
On BEST ANSWER

There are $5!$ ways to lay out the the digits $1$ to $5$ in positions ABCDE.

We need to insert a sixth digit. There are $6$ positions we can place it (before the $A$, between the $A$ and the $B$, etc.....)

We need to insert a sixth digit. The sixth digit could be $0$. It could but $1...5$ or it could but $6,7,8,9$. Each case has its issues.

If the sixth digit is $6,7,8,9$ there is no issue. There are $4$ possible choice, $6$ positions, and $5!$ ways we did the $1...5$. So $4\cdot 6\cdot 5!$ ways to do that.

If the sixth digit is $0$ the only issue is that we can't put it in the $1$ position. SO there is $1$ choice of what digit $0$ could be (namely $0$) and $5$ positions to put it in and $5!$ ways to do the $1....5$. So $5\cdot 5!$ ways to do it.

Now the issue with the sixth digit being $1....5$ is we are double counting. There are $5!$ ways to place the $1$ through $5$. And there are $6$ places to put the $6$th digit. But wherever we put the second copy of the digit would be the same as though we had put it there originally and we put the second copy where the firs was. So there are $5$ choices of the $6$th digit and $6$ places to put it but to take double counting into account; there are $5\times \frac {6\times 5!}2$ ways to do this.

So in total:

$4\cdot 6\cdot 5! + 5\cdot 5! + 5\cdot \frac {6\cdot 5!}2=$

$5!(4\cdot 6 + 5 + 5\times \frac 62) = 120\times (24+5+15)=120\times 44=5280$

6
On

Assuming leading zeroes count as 6 digit numbers. Using the principle of inclusion-exclusion (PIE), we have: $10^6$ ways without any restrictions, $9^6$ ways without including $i_k \in \{1,2,3,4,5\}$ as a digit for which there are $5 \choose 1$ combinations for $i_1$, $8^6$ ways without including $i_1$ nor $i_2$, for which there are $5 \choose 2$ combinations, $7^6$ ways without including $i_1$ nor $i_2$ nor $i_3$, for which there are $5 \choose 3$ combinations, $6^6$ ways without including $i_1$ nor $i_2$ nor $i_3$ nor $i_4$ for which there are $5 \choose 4$ combinations, and finally there are $5^6$ combinations not including any of the digits from $1$ through $5$.

Hence, the solution (including leading zeroes) is:

$$10^6 - {5 \choose 1}(9^6) + {5 \choose 2} (8^6) - {5 \choose 3}(7^6) + {5 \choose 4}(6^6)- 5^6 = 5400$$

If you do not count leading zeroes, subtract the number of combinations with leading zeroes, that being:

$ 5400 - 5! = 5280 $