1
$\begingroup$

How many positive integers less than 1000 have at least one decimal digit equal to 9?

Please correct me:

Answer = (1) + {(1*10) + (9*1)}+ {(1*10*10) + (9*10*1) + (9*1*10)}

==> 9 + 9x + x9 + 9xx + xx9 + x9x

I think I counted 99 twice and 999 three times, are there more cases I over counted?

  • 1
    Yes, you're also double-counting three-digit numbers like $919$, $299$, etc.2012-12-03

2 Answers 2

1

It looks as if you counted numbers like $399$, or $919$, or $991$ more than once.

It is easier to count the numbers that don't have a $9$. There are $8$ from $1$ to $9$. For $10$ to $99$, the first digit can be any of $8$, and for each choice the second digit can be any of $9$, for a total of $8\cdot 9$. Similarly, for $100$ to $999$, the first digit can be any of $8$, and for any first digit, there are $9\cdot 9$ ways to choose the rest, for a total of $8\cdot 9\cdot 9$.

Add up, subtract from $999$.

Another way: It is slightly easier to insert if necessary lead $0$'s to make every number from $0$ to $999$ a three-digit number. Then there are $9^3 -1$ "nine-free" numbers (we do not allow $000$). Subtract from $999$.

1

The numbers you are interested in are of the form $\times \times \times$ where $\times \in \{0,1,2,\ldots,9\}$. $\text{Number of numbers that have at-least one digit as $9$ =}$ $\text{(Number of numbers of the form $\times \times \times$)}$ $ - \text{(Number of numbers of the form $\times \times \times$ with none of the digits as $9$)}$ $\text{Number of numbers of the form $\times \times \times$} = 10 \times 10 \times 10 = 1000$ $\text{Number of numbers of the form $\times \times \times$ with none of the digits as $9$} = 9 \times 9 \times 9$ Hence, $\text{Number of numbers that have at-least one digit as $9$} = 10^3 - 9^3 = 271$