title: Project Euler Program 5 takes too much time in Java
body: <p>The question is:
  What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?</p>
  
  <p>I write the following program which gives the correct output, but it took very long to execute.</p>
  
  <p>What can I do to fasten my program?</p>
  
  <pre><code>    public class ep5 {
  
      public static void main(String[] args) {
  
      int n=100,k=0;
      boolean check=true;
      while(check)
      {   
          k=0;
          n++;
  
          for (int i=2;i&lt;21;i++)
              if(n%i!=0)
                  k=1;
  
          if (k!=1)
              check=false;
      }
      System.out.println(n);
  }
  }
  </code></pre>