# How many $4$-digit numbers that do not have $5$ and have $7$ in the hundreds position?

I encountered this problem:

How many $4$-digit numbers are there that do not have $5$ and have $7$ in the hundreds position? Digits cannot be repeated.

My thinking: first, let's count numbers that do not have $0$. It's going to be $7\cdot 6 \cdot 5$ arrangements. Now, let's count numbers that have $0$ in the tens position. We have two positions open so there are $7 \cdot 6$ arrangements. We get the same number of arrangements for numbers that end with $0$. The total number of arrangements is $7\cdot 6 \cdot 5+ 2\cdot 7 \cdot 6=7\cdot 7 \cdot 6=294$.

However, my friend argues that there are $8$ choices for the last digit, $7$ choices for the tens digits and $6$ choices for the first digit so the total number should be $8\cdot 7 \cdot 6=336$.

I am asking who is right not to prove my friend wrong but to find the truth. Thanks for listening!

294 is correct.

First digit (most significant), can not be 7,0,5, so 7 choices; 3rd digit, cannot be 7,5, and the one chosen for 1st, so 7 choices; 4th digit, 6 choices;

$7\times7\times6=294$

• Welcome to the site. Great first answer! – B. Mehta Apr 14 '18 at 23:17

You are right and your friend is wrong. If you choose the units digit and then choose the tens digit (and are forced to use $7$ for the hundreds digit) then the number of choices for the thousands digit not always $6$: it is either $5$ or $6$, depending on if you've used $0$ yet or not.

For example, there are $5$ numbers satisfying the condition which have the form $x789$ (since $x$ can be any of $1,2,3,4,6$) but $6$ numbers satisfying the condition which have the form $x780$ (since $x$ can be any of $1,2,3,4,6,9$).

All this tells us is that the number of solutions is between $8\cdot7\cdot5 = 280$ and $8\cdot7\cdot6 = 336$, and for a more precise answer we do need to look at whether $0$ gets used.

I think the key disagreement here is that your friend is thinking that $0$ is allowed to be the first digit (say, for a 4 digit passcode), while you are not. If $0$ can be the first digit, your friend is correct, but if not (as other posters explain), you are correct.

You don't have to choice the positions in order so don't worry about $0$s.

Do the Thousandth place first. It can not be $0$ and it can not be $7$ or $5$. So there are $7$ options. Then do either the tens or the ones, it doesn't matter which. It can be $0$ but it can't be $7$ or $5$ and it can't be what the thousandth place was. That is $7$ options as well. And the final position can't be $7$ or $5$ or either of the previous two positions. so that is $6$ options.

So there are $7*7*6 = 294$.

You were correct but you didn't have to work so hard.

Your freind is wrong in that $0$ is not an option for the first digit.