2
$\begingroup$

I need to find the number of $10$ digit numbers containing all odd digits (other digits are allowed, but the number must contain $1$, $3$, $5$, $7$ and $9$). Also, this number cannot contain a $0$.

I have come up with this solution but I am not sure if it's correct:
First, we choose the place-holders for those odd digits - we can do this in ${10 \choose 5} $ ways. Now, arrange our odd digits in these placeholders - $5!$ ways. Next, we fill in the gaps - every digit can go there, and so we have $9^5$ ways to do this. Therefore, the answer is
$${10 \choose 5 } 5! \cdot9^5$$ Is this correct?
Now, how could I solve the exact same problem if we allowed $0$ to appear in this number? Namely, I am addressing the problem of $0$ as the first digit.

$\endgroup$
  • 2
    $\begingroup$ Your method multiply counts numbers with more than one $1$, for example. $\endgroup$ – lulu Mar 12 '18 at 0:48
  • $\begingroup$ @lulu but it is allowed right? 'Next, we fill in the gaps - every digit can go there'. Sorry for bad english $\endgroup$ – Gareth Ma Mar 12 '18 at 0:49
  • 1
    $\begingroup$ @KGSHbteamMineTeamBeastO_ Of course you are allowed to have more than one $1$ but you can't count the same number twice, that's the problem. $\endgroup$ – lulu Mar 12 '18 at 0:50
7
$\begingroup$

It is not correct because you counted $1135792468$ twice, once when the first $1$ was among your first five numbers and once when the second $1$ was among your first five numbers.

You want to use the inclusion-exclusion principle. There are $9^{10}$ ten digit numbers with no zeros. Subtract the ones that are missing $1$, those that are missing $3$, etc. You have subtracted the ones missing both $1$ and $3$ twice, so add them back in and so on. If you search the site there are many examples.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.