Smallest multiple from 1-20

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?


Try other problems Here


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.

2 solutions

Hasmik Garyaka
Sep 17, 2017

We need to multiplicate 2520 on 11,13,17,19 and 2 to divide 16.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
public class Main {
    static long FindLcm(long a,long b) {
    long lcm,hcf = 0;
    long i=1;
    long ger=a>b?a:b;
    while(i<ger) {
        if((a%i==0) && (b%i==0))
            hcf=i;
        i++;
    }
    lcm=(a*b)/hcf;
    return lcm;
}

    public static void main(String[] args) {
        long lcm=1;
        for(long i=2;i<=20;i++) {
            lcm=FindLcm(lcm,i);
        }
        System.out.println("Lcm="+lcm);
    }
}

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...