Skip to content

Instantly share code, notes, and snippets.

@LuxXx
Created April 14, 2017 02:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LuxXx/f2680042285498b1094b8babf7baa9f8 to your computer and use it in GitHub Desktop.
Save LuxXx/f2680042285498b1094b8babf7baa9f8 to your computer and use it in GitHub Desktop.
Project Euler - Problem 5
package euler;
public class Divisible {
public static void main(String[] args) {
for (long i = 0; i < Long.MAX_VALUE; i++) {
if (isDivisible(i)) System.out.println(i);
}
}
public static boolean isDivisible(long n) {
for (int i = 1; i <= 20; i++) {
if (n % i != 0) return false;
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment