Too Long A Sum ? ( Sum of All The Digits of Integers )

Algebra Level 3

The sum of digits of numbers from 98 to 101 is: 9 + 8 + 9 + 9 + 1 + 0 + 0 + 1 + 0 + 1 = 38 9+8+9+9+1+0+0+1+0+1 = 38 . What is the sum of all the digits of the integers from 1 to 2008?

Note that the sum of digits of a number x x in base b b is given by:

n = 0 log b x x m o d b n + 1 x m o d b n b n \large \sum_{n=0}^{\lfloor \log_b x\rfloor} \frac {x \bmod b^{n+1}- x \bmod b^n}{b^n}

Notation: \lfloor \cdot \rfloor denotes the floor function .

27018 30054 28036 30036 28054

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

Chew-Seong Cheong
Apr 28, 2018

Let the sums of unit digits, tenth digits, hundredth digits and thousand digits be s 0 s_0 , s 1 s_1 , s 2 s_2 and s 3 s_3 respectively. Then we have:

s 0 = 1 + 2 + + 9 + 0 + 1 + 2 + + 9 + 0 + + 1 + 2 + + 9 + 0 2008 10 times + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 = 200 × 45 + 36 = 9036 \begin{aligned} s_0 & = \underbrace{{\color{#3D99F6}1+2+\cdots+9 + 0} + {\color{#D61F06}1+2+\cdots+9+ 0} + \cdots + {\color{#3D99F6}1+2+\cdots+9 +0}}_{\left \lfloor \frac {2008}{10}\right \rfloor \text{ times}} + 1+2+3+4+5+6+7+8 \\ & = 200 \times 45 + 36 = 9036 \end{aligned}

Similarly,

s 1 = 2008 100 × 45 × 10 = 9000 s 2 = 2008 1000 × 45 × 100 = 9000 s 3 = 1 × 1000 1000 to 1999 + 2 × 9 2000 to 2008 = 1018 \begin{aligned} s_1 & = \left \lfloor \frac {2008}{100} \right \rfloor \times 45 \times 10 = 9000 \\ s_2 & = \left \lfloor \frac {2008}{1000} \right \rfloor \times 45 \times 100 = 9000 \\ s_3 & = \underbrace{1 \times 1000}_{\text{1000 to 1999}} + \underbrace{2 \times 9}_{\text{2000 to 2008}} = 1018 \end{aligned}

Therefore, the sum of digits from 1 to 2008 is s 0 + s 1 + s 2 + s 3 = 9036 + 9000 + 9000 + 1018 = 28054 s_0+s_1+s_2+s_3 = 9036+9000+9000+1018 = \boxed{28054} .

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...