Question
Question: The number of times the digit 5 will be written, when all the numbers from 1 to 1000 are written is...
The number of times the digit 5 will be written, when all the numbers from 1 to 1000 are written is
300
243
297
None of these
300
Solution
Observe that 1000 does not contain the digit 5. While listing the numbers from 1 to 999, we have to write a sequence of three digits such as xyz where x, y, z ∈ {0, 1, 2, 3, 4, 5, 6, 7, 8,9}.
When 5 occurs only at one place (which can happen in 3C1=3 ways) then the other two places can be filled in 9 x 9 ways. So, in this case 5 will be written 3 x 9 x 9 times.
(∵5 may occur in any one of the 3 places).
When 5 occurs at two places (which can happen in 3C2=3 ways) then the third place can be filled in 9 ways. So, there will be 3 x 9 = 27 such numbers and while writing any such number 5 will be written twice. So, in this case 5 will be written 2 x 27 times.
When 5 occurs at all the three places (which can happen in only one way), we have to write 5 three times while listing the only number so formed.
Hence, the required number of times 5 will be written
= 3 x 9 x 9 + 2 x 27 + 3
= 243 + 54 + 3 = 300