John is bored

John was bored and decided to write down the numbers from 1 1 to 222222 222222 . How many 0 s 0's has he written?


The answer is 108642.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Vijay Bhaskar
Jun 14, 2015

If the number of zeroes occurring at 10^k place till a particular number N is:

min(10^k * floor(N/10^(k+1)),N mod 10^(K+1))+(10^k-1) * floor(N/10^(k+1)))

Hence the answer is (adding the number of times zero occurs in places 10^0, 10^1, 10^2, 10^3 and 10^4):

22222 + 2222 * 10 + 222 * 100 + 22 * 1000 + 2 * 10000=108642

Moderator note:

Can you explain the formula?

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...