P.E.5: Smallest Multiple

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?


The answer is 232792560.

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.

4 solutions

Prashant Gupta
Oct 2, 2014

2520 is the least number which is divisible by any no's i 1to 10.

now to find the least number which is divisible by any no's 1 to 20.

2520 is not div. by 11,13,16,17,19 without any remainder.and all other no's will divide 2520.

so we multiply in 2520 by 11,13,17,19 and 2 bcoz 8 divides , now only 2 remains...... 16=8*2

..........so now the answer is

                          =2520*2*11*13*17*19
                          =232792560.

It is my first solution.I hope ,you guy's will like this......

Mine was kind of a brute solving algorithm, though I saw the pattern you did earlier.. This code was to give an insight into the possible algorithm that could be used.

Nevertheless, your solution for solving it by hand is well thought out. Cheers.. You deserve an up vote.

Arvind Srinivasan - 6 years, 7 months ago
Arvind Srinivasan
Sep 29, 2014

My python code is as follows:

    """
    Euler Problem #5:
    2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
    What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
    """
    numcheck = [11, 13, 14, 16, 17, 18, 19, 20]
    def answer(fin_step):
        for num in xrange(fin_step, 999999999, fin_step):
            if all(num % n == 0 for n in numcheck):
                return num
        return None
    solution = answer(20)
    if solution is not None:
       print "the smallest positive number that is evenly divisible by all of the numbers from 1 to 20 is"
       print solution
    raw_input()

Hope this helps!

Dinesh Grover
Oct 21, 2014

just find the lcm of 1 to 20

Parveen Soni
Oct 16, 2014

Find all prime factor with max. power in that given range like for 1 to 10, power of 2 can be max. 3. hence (2^3)x(3^2)x(5^1)x(7^1)=2520 Similarly for range 1 to 20 (2^4)x(3^2)x(5^1)x(7^1)x(11^1)x(13^1)x(17^1)x(19^1)=232792560

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...