How many numbers of 4 digits have at least three specific digits

209 Views Asked by At

The question I tried to solve goes like this:

How many 4-digit numbers have at least one digit $2$, one digit $3$ and one digit $4$?

I saw it as simple as this (because it's exactly 4 digits): The number will have a $2$, a $3$, a $4$ and $X$.

So the solution I thought would be is:

$$3 \cdot 2 \cdot 1 \cdot 10 = 60 $$

$X$ could be any digit of the $10$ digits.

However, this also includes numbers that start with $0$. This can't count so I remove $6$ because of

$$0234,0324,0342,0432,0243,0423$$

so the solution would be $54$.

However, this isn't at all the solution. What am I missing?

3

There are 3 best solutions below

0
On BEST ANSWER

Here is an other way to evaluate the number of possibilities. We will condition on the fourth number we have

Case: $0$

If the fourth number is $0$, it can't ne in the first position. It has three places where it can go. Next we put the $4$ (three remaining places), etc. This gives us $$3\times3\times2\times1=18\tag1$$

Case: $1,5,6,7,8,9$

There are six choice for the number and four places to put it. Then, we put the $4, 3$ and $2$ as before. This gives us $$6\times4\times3\times2\times1=144\tag2$$

Case: $2,3,4$

We now have a repeated number. First we chose which one is repeated (three choices) and where to put them, $4\choose2$. Finally, we put the remaining numbers. This gives us $$3\times{4\choose2}\times2\times1=36\tag3$$ There are $18+144+36=198$ such numbers.

Hope it helps


You could also find the same result starting with you reasoning. Starting with $$3\times2\times1\times10$$ You counted nombre of the form $3245$ but not $5324$. The fourth digit you chose was always the last digit of the number. You need to add a $\times4$ to choose where you put the last digit. $$3\times2\times1\times10\times4=240$$ Now we counted numbers starting with $0$, we need to remove them ($6$ cases). Also, if the fourth number was a $2$, it was counted twice. $234(2)$ is the same as $(2)342$ where $(2)$ represents the fourth digit. So we need to remove the number where the fourth digit is $2,3$ or $4$. ($36$ cases).

This bring us back to $240-6-36=198$ possibilities.

1
On

What you're missing is that $X$ can also be $2, 3$ or $4$, and so you'll have counted some of the solutions twice (for example $2X34$ and $X234$ are the same if $X = 2$).

What you should do to fix this is to handle cases; one case for when the number has all digits different, and one case where one of $2, 3, 4$ is repeated.

3
On

The main reason for your original formula being too low is that you do not count the order/the permutations of the last digit. You only account for choosing it.


One way to break it down is that you either have:

  • Four distinct digits which then can be ordered in $4!$ ways
  • Three distinct digits with one digit being repeated twice

The first case is fairly simple, namely the fourth digit should be chosen from the 7 possible digits $D\setminus\{2,3,4\}=\{0,1,5,6,7,8,9\}$. This gives you $$ 7\cdot4!=168 $$ possibilities for the first case.

The second case is a bit more elaborate, but still not too bad. One way to do it is to choose the fourth digit from $\{2,3,4\}$ and then place the two unique digits. This gives $$ 3\cdot 4\cdot 3=36 $$ possibilities for the second case, namely chose one of three, place first unique digit in one of four places, then place second unique digit in one of three remaining places. The last two places must hold the repeated digit.

A total of $168+36=204$ such numbers can be formed. Then you have to discard numbers starting with a leading zero. Those will be $3!=6$ so you get down to $198$ as a total.