Combinatorics: Between 1000 and 9999, how many numbers contain "3" only once? Answer: 2673

1.3k Views Asked by At

Okay so I'm doing combinatorics and I have the following question:

Between 1000 and 9999, how many numbers contain "3" only once? (So the number 3 has to be only once in the whole number). The answer is 2673.

I can't come to the right answer cause how I would proceed is like this:

1 9 9 9 --> since I can have 3 only once I would do 9^3 times 4.

2

There are 2 best solutions below

0
On BEST ANSWER

Probably the only trap is that numbers don't start with 0.

If the 3 is in the first place...

...then we can choose from 9 other digits in the other three places, giving $9^3=729$ possibilities.

If the 3 is any other place...

...then we can choose 8 other digits in the first place (not 3 and not 0), and we can choose from 9 other digits in the other two places, giving $8 \times 9^2=648$ possibilities.

In total: $729+3 \times 648=2673$.

0
On

The expression $9^3 \times 4$ is counting some numbers like $0300$, which are less than $1000$. We can fix this as follows:

The first digit could be $3$, which gives us $9^3$ possibilities.

The second, third, or fourth digit could be $3$, and each of these cases gives us $8 \times 9^2$ possibilities. (Remember the first digit cannot be $0$.)

So the total number of possibilities is $$ 9^3 + 8 \times 9^2 \times 3 = 2673. $$