Let's write down the natural numbers from 1 to 1002003. What is the sum of the digits written?
Problem 967
Official solution
I. solution. Let's determine the sum after writing the number 999999. We can think that the numbers were written by a numbering machine, which even writes single-digit numbers as six-digit numbers with leading zeros that do not change the sum, and for the same reason, the machine also wrote the number 000000.
Thus, the number of written numbers is , the number of digits is , and the machine struck each of the 10 different digits the same number of times in each of the 6 different place values (in the hundred-thousands, ten-thousands, ..., units place), i.e., times, so the sum so far is .
Proceeding to the writing of 1001999, we write 1's in the millions place and 1's in the thousands place, and we write the numbers from 000 to 999 twice (the other written digits are 0). The sum of the digits of the latter, by similar reasoning as above,
here, the sum of the digits is .
Finally, in the remaining 4 numbers, the sum is , so the sought sum is 27030018.
Judit Katona (Budapest, Kaffka M. gimn. I. o. t.) Péter Ágoston (Budapest, Berzsenyi D. gimn. I. o. t.)
Remark. The sum of the digits in the complete millions and thousands series can also be obtained by pairing the numbers from the front and back. For example, for the six-digit numbers:
In this case, the sum of the digits in each place value is 9, so the sum of the digits in each pair is . On the other hand, there are half a million pairs, so the sum of the 6 million digits written is 27 million.
II. solution. We determine the sum of the digits by place value, again writing 0 at the beginning of the numbers. The 1002004 number written consists of 100200 complete 10-number sequences, in which stand one after the other, so the sum in each place value is:
Similarly, in the tens and hundreds place values, the same digit stands 10 by 10, and 100 by 100, but up to 1001999, each digit appears the same number of times, so the sum, after the number of sequences is 10020:
In the thousands and millions place values, the 1's digit appears more often than the others, and the 0 also appears in the and place values, respectively:
Thus, the sum of the column sums is 27030018.