Digit sums problem

The digit-sum of a number is the sum of its digits till a single digit is left.

For example: 39 = 3+9 = 12 = 1+2 =3. So 3 is the digit-sum of 39.

If the digit-sums of all the integers starting from 1 are added, at which integer would the sum of the digit-sums cross 2017?

405 406 403 404

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.

2 solutions

Fletcher Mattox
Sep 24, 2020
1
2
3
4
5
6
7
8
9
sumsum = 0
n = 0
while sumsum < 2017:
    n += 1
    dsum = sum(list(map(int, str(n))))
    while dsum > 9:
        dsum = sum(list(map(int, str(dsum))))
    sumsum += dsum
print(n)

Chris Lewis
Oct 31, 2019

The digit sum of n n is the same as its remainder when divided by 9 9 , unless n n is a multiple of 9 9 , in which case the digit sum is 9 9 .

So the sum of the digit sums of every nine consecutive numbers is 45 45 .

45 × 45 = 2025 45\times 45=2025 ; so the sum of the first 45 45 sets of 9 9 consecutive numbers (ie the sum of digit sums from 1 1 to 45 × 9 = 405 45\times 9=405 is 2025 2025 . The sum up to 404 404 is therefore 2016 2016 , so we cross 2017 2017 at n = 405 n=405 .

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...