题目描述
代码实现
package TEST;
public class Main {public static void main(String[] args) {int cnt = 0;for (int i = 2; ; i ++)if(check(i)){cnt ++;if(cnt == 2019){System.out.println(i);break;}}}public static boolean check(int n){//判断一个数是否为质数for (int i = 2; i <= (int) Math.sqrt(n); i ++)if(n % i == 0) return false;return true;}
}
答案
17569