Are we counting the number of times the digit zero appears? For example, would 1,000,000 result in 6 zeroes? If so, you can count the zeroes as follows:
First, count the numbers of the form nnnnnn0... 10, 20, 30, ..., 100, 110, 120, ..., 999990, 1000000. Every 10th number will have this form, so that is 100,000 zeroes in the units place (don't count zero, but do count 1 million).
1,000,000 * 1/10 = 100,000
100,000 - 1 + 1 = 100,000
Next, count nnnnn0n... 100, 101, 102, 103... 109, 200, 201, 202, ... 209, .... 999900, 999901, 999902, ..., 999,999, 1,000,000. This would be 10 out of every hundred numbers, so that is 99,991 zeroes in the tens place. (You don't count 0 to 9), but you do count 1 million.
1,000,000 * 10/100 = 100,000
100,000 - 10 + 1 = 99,991
Next, count nnnn0nn. This would be 100 out of every thousand numbers, but not counting 0 to 99, but counting 1 million. So that is 99,901.
1,000,000 * 100/1000 = 100,000
100,000 - 100 + 1 = 99,901
Next, count nnn0nnn. This would be 1000 out of every ten thousand numbers, but not counting 0 to 999, but counting 1 million. So that is 99,001.
1,000,000 * 1000/10000 = 100,000
100,000 - 1,000 + 1 = 99,001
Next, count nn0nnnn. This would be 10000 out of every hundred thousand numbers, but not counting 0 to 9999, but counting 1 million. So that is 90,001.
1,000,000 * 10000/100000 = 100,000
100,000 - 10,000 + 1 = 90,001
Finally, count n0nnnnn. Without a leading digit, none of the numbers except 1 million would have this pattern:
1,000,000 * 100000/1000000 = 100,000
100,000 - 100,000 + 1 = 1
100,000 + 99,991 + 99,901 + 99,001 + 90,001 + 1 = 488,895
So the answer is that the digit zero appears 488,895 times in the numbers from 1 to 1 million, inclusive.
2006-11-13 08:37:51
·
answer #1
·
answered by Puzzling 7
·
1⤊
1⤋