First, change the numbers from "1 to 10,000,000" to the boundaries to . Note two things:
1) Changing the "boundaries" from to and from to only changes two numbers, and neither of those numbers contain sevens.
2) Leading zeros won't affect the number of sevens.
As such, we have numbers that have digits each (including leading zeros). Thus, we have a total of digits that we write.
By symmetry, each digit appears exactly as often as each other digit. Every combo of digits gives a viable seven digit number. Thus, of the digits, or digits, will be seven.
tell me if i am correct. i have not done it myself.
I did this yesterday. I had actually got a similar question in an exam paper.
So I thought I ought to post it. hope you will appreciate.
For all the numbers from 1 to 100,
5 occurs in the units digit exactly 10 times.
Also 5 occurs in the tens digit 10 times.
Notice here the case of the number 55.
Simply by adding we get that 5 occurs 20 times from 1 to 100.
For 1 to 1,000.
Follow the same procedure. That is we get 20 times 5 from 100 to 200.
Similarly 20 times 5 from 200 to 300.
But remember that for 500 to 599 we have to add extra 100 to the answer (cause of the hundredth place).
So we get 20*10 + 100 = 300.
For 1 to 10,000.
We can do 300*10 + 1000 = 4000
For 1 to 1,00,000.
We get 4,000*10 + 10,000 = 50,000
We can generalize this here.
The first digit of the answer has the same number of zeroes as are there until the last digit of the number like in 100, 1,000, 10,000 we have the first digits of the answer as 2, 3, 4 respectively.
The number of zeroes after the first digit in the answer is simply one less than the first digit itself……
Thanks for this nice problem.
Then I remembered your post.
Now I pose a question. Its just a variation.
Find the number of times ‘54’ occurs in writing all the digits from 1 to 1,00,000.. I mean that 4 occurs right next to 5.