歐拉計劃----https://projecteuler.net/spa
最小倍數
2520是最小的可以被1到10整除的數。.net
最小的可以被1到20整除的正數是多少?code
public class Problem5 { static long cal() { int [] a= {2,3,5,7,11,13,17,19}; long s=0; out: while(true) { s++; for (int i = 0; i<=a.length-1; i++) { if(s%a[i]!=0) { continue out; } } return s; } } public static void main(String[] args) { long start = System.currentTimeMillis(); System.out.println(cal()); long end = System.currentTimeMillis(); System.out.println("runtime:" + (end - start)); } }