Olympiad Maths Prep

Track / Stage 5 / 367 of 400 #967 of 2000

Problem 967

AIME late
Number theory Difficulty 5.9 Find the answer

Let's write down the natural numbers from 1 to 1002003. What is the sum of the digits written?

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 10610^{6}, the number of digits is 61066 \cdot 10^{6}, 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., 10510^{5} times, so the sum so far is 6105(0+1+6 \cdot 10^{5}(0+1+ +2++8+9)=27106+2+\ldots+8+9)=27 \cdot 10^{6}.

Proceeding to the writing of 1001999, we write 21032 \cdot 10^{3} 1's in the millions place and 10310^{3} 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,

23102(0+1++9)=27103 2 \cdot 3 \cdot 10^{2}(0+1+\ldots+9)=27 \cdot 10^{3}

here, the sum of the digits is 31043 \cdot 10^{4}.

Finally, in the remaining 4 numbers, the sum is 3+4+5+6=183+4+5+6=18, 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:

000000 and 999 999, 000001 and 999 998, ..., 499999 and 500000. 000000 \text { and } 999 \text { 999, } 000001 \text { and } 999 \text { 998, ..., } 499999 \text { and } 500000 .

In this case, the sum of the digits in each place value is 9, so the sum of the digits in each pair is 69=546 \cdot 9=54. 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 0,1,2,,90,1,2, \ldots, 9 stand one after the other, so the sum in each place value is:

100200(0+1++9)+(0+1+2+3)=4509006 100200(0+1+\ldots+9)+(0+1+2+3)=4509006

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:

1002010(0+1++9)+40=4509000,1002100(0+1++9)+40=4509000 \begin{array}{r} 10020 \cdot 10(0+1+\ldots+9)+4 \cdot 0=4509000, \\ 1002 \cdot 100(0+1+\ldots+9)+4 \cdot 0=4509000 \end{array}

In the thousands and millions place values, the 1's digit appears more often than the others, and the 0 also appears in the 10410^{4} and 10510^{5} place values, respectively:

1001000(0+1++9)+1000(0+1)+42=45010081010000(0+1++9)+20040=4500000100000(0+1++9)+20040=450000020041=2004 \begin{array}{rlr} 100 \cdot 1000(0+1+\ldots+9)+1000(0+1)+4 \cdot 2 & =4501008 \\ 10 \cdot 10000(0+1+\ldots+9)+2004 \cdot 0 & & =4500000 \\ 100000(0+1+\ldots+9)+2004 \cdot 0 & & =4500000 \\ 2004 \cdot 1 & & =2004 \end{array}

Thus, the sum of the column sums is 27030018.

Source: NuminaMath-1.5, licensed Apache-2.0. Statement and solution reproduced as published; topic, difficulty and ordering added by this site.