If we listed all numbers from $100$ to $10,000$, how many times would the digit $3$ be printed?

178 Views Asked by At

My attempt:

No of digits that don't contain $3$ $=(8 \cdot 9 \cdot 9 + 8 \cdot 9 \cdot 9 \cdot 9)$.

Digits that contain $3$ $=9900-(8 \cdot 9 \cdot 9+ 8 \cdot 9 \cdot 9 \cdot 9)= 3420$, but this answer is wrong how?

3

There are 3 best solutions below

1
On BEST ANSWER

You correctly calculated the number of digits containing the number $3$, but not the number of times the digit $3$ appears in the numbers. For example, in the number $333$, the digit $3$ appears three times, but you only count it once.

0
On

It's the same as how many digit 3s you need to list all of the numbers from 0100 to 9999 (with leading zeros).

And that is again the same as how many 3s you need to list the numbers from 0000 to 9999, minus how many 3s you need to list the numbers from 00 to 99.

The two latter counts are easy: each of them is a tenth of all the 40,000 (respectively, 200) digits you're going to print in total.

0
On

From $0$ to $9$, once.

From $0$ to $99$, $10$ times the count of $0$ to $9$, plus once per decade, i.e. $20$.

From $0$ to $999$, $10$ times the count of $0$ to $99$, plus once per decade, i.e. $300$.

More generally, from $0$ to $999\cdots9$ ($n$ digits), $n\times 1000\cdots0$.