Big smallest multiple

What is the sum of the digits of the smallest number that is evenly divisible by all of the numbers between 1 to 100?


The answer is 171.

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

Arulx Z
Aug 14, 2015

Manual way -

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
>>> def gcd (a, b):
        while b > 0:
            temp = b
            b = a % b
            a = temp
        return a
>>> def lcm (a, b):
        return a * (b / gcd (a, b))
>>> temp = 2
>>> for x in xrange (3, 100):
        temp = lcm (temp, x)
>>> sum(int(x) for x in str(temp))
171

Moderator note:

Thanks for showing the "manual" way of calculating the LCM through a recursive format.

Haskell: foldl1 lcm [1..100]

The output are 69720375229712477164533808935312303556800, and the sum of the digits of this number are 171

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...