Sum of sum

The function f ( x ) f(x) is the sum of digits of x x ; for example: f ( 24 ) = 6 f(24)=6 , f ( 78 ) = 15 f(78)=15 , and f ( 144 ) = 9 f(144)=9 (note that f ( 99 ) = 18 f(99)=18 and not 1 + 8 = 9 1+8=9 ).

Find f ( 1 ) + f ( 2 ) + f ( 3 ) + + f ( 1000 ) f(1)+f(2)+f(3)+ \cdots + f(1000) .

None of the other choices. 11458 24445 12456

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.

3 solutions

We note that the sum of digits of 4-digit numbers is the sum of sum of individual unit, ten, hundred, and thousand digits. Let n = d 3 d 2 d 1 d 0 n=\overline{d_3d_2d_1d_0} , then we have:

n = 1 1000 f ( n ) = n = 1 1000 d 0 n + n = 1 1000 d 1 n + n = 1 1000 d 2 n + n = 1 1000 d 3 n \sum_{n=1}^{1000} f(n) = \sum_{n=1}^{1000} d_{0n} + \sum_{n=1}^{1000} d_{1n} + \sum_{n=1}^{1000} d_{2n} + \sum_{n=1}^{1000} d_{3n}

  • For the unit digit d 0 n d_{0n} , we have 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 = 45 1+2+3+4+5+6+7+8+9 = 45 for every 10, since we have 100 × \times 10 in 1000, n = 1 1000 d 0 n = 100 × 45 = 4500 \displaystyle \implies \sum_{n=1}^{1000} d_{0n} = 100 \times 45 = 4500 .
  • Similarly, for the ten digit d 1 n d_{1n} , we have 450 for every 100, since we have 10 × \times 100 in 1000, n = 1 1000 d 1 n = 10 × 450 = 4500 \displaystyle \implies \sum_{n=1}^{1000} d_{1n} = 10 \times 450 = 4500 .
  • For the hundred digit d 2 n d_{2n} , we have 4500 for every 1000, since we have 1 × \times 1000 in 1000, n = 1 1000 d 2 n = 1 × 4500 = 4500 \displaystyle \implies \sum_{n=1}^{1000} d_{2n} = 1 \times 4500 = 4500 .
  • For the thousand digit d 3 n d_{3n} , we have only f ( 1000 ) = 1 f(1000) = 1 , n = 1 1000 d 3 n = 1 \displaystyle \implies \sum_{n=1}^{1000} d_{3n} = 1 .

Therefore, n = 1 1000 f ( n ) = 4500 + 4500 + 4500 + 1 = 13501 \displaystyle \sum_{n=1}^{1000} f(n) = 4500+4500+4500+1 = 13501 None of the other choices. \implies \boxed{\text{None of the other choices.}}

Zee Ell
Aug 8, 2016

The question asks for the sum of the sum of the digits of integers from 1 to 1000.

This sum won't change, if we add the 0. So let's write all numbers from 0 to 999 (1000 numbers) with three digits (e.g. 0 = 000, 7 = 007, 12 = 012, 789 = 999) as a first step.

Since all the 10 digits from 0 to 9 occur equally likely (each of them 1000 / 10 = 100 times at each place (units, tens, hundreds)), therefore the sum of the digits for one place is:

100 × ( 0 + 1 + 2 + . . . + 8 + 9 ) = 100 × 10 × ( 0 + 9 ) 2 = 4500 100 × (0 + 1 +2 + ... + 8 + 9) = 100 × \frac {10 × (0 + 9)}{2} = 4500

The sum of sum of digits for integers from 0 to 999 (or from 1 to 999) is three times as much as this (3 places):

3 × 4500 = 13500

And the sum from 1 to 1000 is just our sum from 1 to 999 and the sum of the digits of 1000 (1 + 0 + 0 + 0 = 1):

13500 + 1 = 13501 13500 + 1 = \boxed {13501}

Hence, our answer is "None of the other choices".

Prince Loomba
Aug 8, 2016

class MyClass {

public static void main(String[ ] args) {


     int sum=0;


      for(int n=1;n<=1000;n++){


      int b=Integer.toString(n).length();


                   for(int a=0;a<=b-1;a++){


                       sum+=(int)(n/(Math.pow(10,a)))%10;


                   } 


      }


      System.out.println(""+sum);


}

}

OUTPUT 13501

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...