# How many $6$ digit numbers can be formed with the numbers $0, 1, 2$ if the number must contain at least one $0$?

So the question is: How many $6$ digit numbers can be formed with the numbers $0, 1, 2$ if the number must contain at least one $0$?

I have searched and found some similar questions so I hope this is not a duplicate. I would please like you to explain where my thinking goes wrong with this problem.

My #1 attempt at a solution:

To start, to create a number that satisfies the question it has to be on the form:

$1 \times 3 \times 3 \times 3 \times 3 \times 3$ Where the "$1 \times$" represent that there must be at least one $0$.

This gives us $3^5$ possibilities.

Since the "mandatory" $0$ could be placed in six different spots we get that there are: $6 \times 3^5$ possibilities.

This leaves us with a set of numbers that have duplicates and I cannot see any direct formula to subtract these duplicates.

My #2 attempt at a solution:

Here I can start with a set of all the possible numbers that could be generated:

$3 \times 3 \times 3 \times 3 \times 3 \times 3 = 3^6$ and subtract that with the set of numbers that does not contain a zero: $2 \times 2 \times 2 \times 2 \times 2 \times 2 = 2^6$.

This would give me the answer: $3^6 - 2^6$. Which seems to be wrong.

Thank you!

• Your second attempt is very close, but you will find that the product of threes has to start with a $2$, since the first digit cannot be a $0$ (it wouldn't be a $6$-digit number if it did). So $2\cdot 3^5 - 2^6$ would be my guess. – Arthur Jan 21 '14 at 10:18

Your second solution is almost right, but $3^6$ includes the numbers which have $0$ as the left-most digit. So, you need to eliminate these numbers. Hence, the answer is $$2\cdot 3^5-2^6.$$
The number of all possible numbers is not $3^6$ as the first digit must be $1$ or $2$, so the number of all possible $6$ digit numbers is $2\cdot 3\cdot 3\cdot 3\cdot 3\cdot 3$