mbaaccount1234
Hey all,
My approach was, there are 998 numbers between 1-1000 (as it does not say it is inclusive)
So, I subtract the times when 7 does not appear
For X
- 7 times (2,3,4,5,6,8,9)
For XX
- 8x9 = 72
- Here for the tens (1,2,3,4,5,6,8,9)
- For the units (0,1,2,3,4,5,6,8,9)
For XXX
- 8x9x9 = 648
So, 998 - 7 - 72 - 648 = 271
Where did I go wrong?
BunuelFirst of all, "when
listing the integers from 1 to 1000" implies that both 1 and 1000 are included.
However, this is not the main issue. The question does
not ask for the number of integers that contain the digit 7; rather, it asks for the
number of times the digit 7 is written when listing the integers from 1 to 1000.
For example, the number 77 contains the digit 7 twice, and the number 777 contains it three times. In your method, you're only counting how many numbers include the digit 7 at least once, but some of those numbers contain it more than once. To answer the actual question, you'd need to account for repeated occurrences of 7 within a single number and add those accordingly.