# How many odd three-digits numbers are there whose all three digits are different

I faced this problem on one test. I wrote my solution but then I found out that my solution is wrong, I still cannot find where my mistake is.

The problem says: How many three-digits numbers are there such that they are odd and their digits are all different.

Here is my approach:

We have three digits. Since the number should be odd, the last digit should be one of those numbers $1, 3, 5, 7, 9$. Now the second digits can be one of the digits: $0, 1, 2, 3, 4, 5, 6, 7, 8, 9$ There are 10 different digits for the second digits, but since the digits should be different we cannot place 10 digits, but we can place 9 digits. And for the first digits we can place digits in the range $1...9$ but we cannot place the digits that are used in the two other digits and we can place only 7 digits.

So my result is $7\cdot9\cdot5 = 315$

However the result is not correct, because there are $320$ odd three-digits numbers with different digits.

Can you point me where is my mistake, thanks in advance.

• The mistake is you might have used 0 for the middle digit. So there are two cases. – quasi Jul 9 '17 at 8:36
• I don't see why we cant use the 0 for the middle digit, number 503, 305, 307 are all valid for counting. – someone123123 Jul 9 '17 at 8:39
• @someone123123 if you use 0 for the middle digit, you have 8 options available for the first digit. This gives 5 additional cases. – IanF1 Jul 9 '17 at 15:34
• To really pinpoint the problem: "For the first digits we can place digits in the range 1...9 [good so far] but we cannot place the digits that are used in the two other digits [still good] and we can place only 7 digits [this is not correct!].". – Daniel Wagner Jul 9 '17 at 23:19

Problems of this type are often solved more simply if we place the digits in a suitable order, instead of necessarily left to right.

Here we'll place the digits in the order last-first-second, i.e. in the order $Units-Hundreds-Tens$

• $5$ choices for the last digit (to make the number odd)

• $8$ choices left for the first digit (since $0$ can't be used)

• $8$ choices still left for the second digit (since $0$ is now available for use)

Thus, without breaking up into cases, we get $5\cdot8\cdot8 = 320$

The mistake is you might have used $0$ for the middle digit. So there are two cases.

Case ($1$): Using $0$ for the middle digit:

$\qquad$The count is $5\,{\times}\,1\,{\times}\,8=40$.

Case ($2$): Not using $0$ for the middle digit:

$\qquad$The count is $5\,{\times}\,8\,{\times}\,7=280$.

So you get a total count of $40+280=320$.

• Thanks for the answer, but can you explain why having 0 for middle digits makes difference. – someone123123 Jul 9 '17 at 8:44
• Because if you use $0$ for the middle digit, the leading digit has only two exclusions, not three. – quasi Jul 9 '17 at 8:46

Since this problem is only created by one single digit i.e. zero as you can't put zero on hundred's place like 013 which is not 3 digit number so when you put zero on the ten's place i.e. in the middle you will get 8 remaining digits for hundred place. Therefore we have two cases which are: Case (1): Using 0 for the middle digit.

The count is 5×1×8=40.

Case (2): Not using 0 for the middle digit.

The count is 5×8×7=280.

So you get a total count of 40+280=320.