Use ZZTA (the Zanti Zero Tabulation Algorithm) to count all the zeroes from 1 to n. Working from right to left:
Zeroes in units position: 10,055,940,436
Zeroes in 10s position: 10,055,940,430
100s: 10,055,940,400
10^3: 10,055,940,000
10^4: 10,055,934,366
10^5: 10,055,900,000
10^6: 10,055,000,000
10^7: 10,050,000,000
10^8: 10,000,000,000
10^9: 9,559,404,366
10^10: 559,404,366
The count for each position is derived by the following rules:
(1) If the digit at the 10^n position is not zero, repeat all the digits to the left of it, and add zeroes for all the digits to the right of it. For example, the 10^6 digit is 9, so repeat the 10055 to the left of the 9 and add six zeroes for the six digits to the right of the 9, giving 10,055,000,000.
(2) If the digit at the 10^n position is zero: (a) repeat all the digits to the left of it and subtract 1, then (b) append all the digits to the right of it and add 1. For example, the 10^4 digit is 0, so repeat the 1005594 and subtract 1, giving 1005593. Then append the 4365 and add 1. The result is 10,055,934,366.
Once you have the counts for each position, just add then up to get the total number of zeroes in the numbers from 1 to n. I get 100,559,404,364. Oh, but you asked to start from 0 rather than 1, so add 1 to that, giving 100,559,404,365. Whoa, deja vu....
* * * *
Scythian: I corrected the 10^n exponents. I had all the numbers, just mislabelled the 10^n exponents after 3. Of course, the digit for 10^3 position is the fourth digit from the right, etc.
2007-06-23 01:51:49
·
answer #1
·
answered by Anonymous
·
2⤊
0⤋