# how many times is the digit 5 written when listing all numbers from 1 to 100,000?

eg. 5 - 1 time

55 - 2 times

5205 - 2 times

Update:

the answer should be 50,000 but i'm not sure how to go about.

Relevance

As a start, look at the numbers from 0 to 9... each digit 0 through 9 appears once, or 10% of the time.

Now look at the numbers 00 to 99, including the extraneous leading zeroes... each digit 0 through 9 appears 20 times in the sequence (i.e., count the number of 5 in this range to verify this), and there are a total of 100*2 = 200 digits. Thus, each digit 0 to 9 comprises 10% of the total pool of digits that appears in that range of numbers.

This pattern holds for 00000 to 99999 (100000 itself is inconsequential); thus, there are 100000*5 = 500000 total digits, and 5 comprises 10%, or 50000 of those digits.

(Note that for 1 to 100000, you have one more 0 than the other digits; the algorithm above starts counting at 00000 rather than 00001 and ends at 99999 rather than 100000. The number of 1s is the same, as are the rest of the digits.)

If there is 5 in the units place there can be 20000 possibilties of numbers.

[In tens place there are 10 possibilities(0-9), hundreds place there are 10 possibilities ....................... In hundred thousands place there are only 2 possibilities(0 & 1).

So taking in account basic principle of counting we get the number of possibilities as 10*10*10*10*2=20000]

Similarly we get 20000 possibilities when 5 is in tens place & so on till ten thousands place. 5 cannot be in hundred thousands place. So by adding we get 100000.

number of ways of locating 5 is.....total ways of locating a number is...................... 9*10*10*10*10*10=900000;

number without atleast one five is........9*10*10*10*10*1 + 1*10*10*10*10*10======190000

now the taotal ways of locating five is .......900000-190000

which is equal to 710,000

• Anonymous