答案必须是
11 101 131 151 181 191 313 353 373 383
727 757 787 797 919 929
答案必须是
11 101 131 151 181 191 313 353 373 383
727 757 787 797 919 929
public class Test {
public static void main(String[] args) {
for (int i = 1; i <= 1000; i++) {
if (!check(i)) {
continue;
}
if (huiweishu(i)) {
System.out.println(i);
}
}
}
private static boolean check(int num) {
int sqrt = (int) Math.sqrt(num);
for (int j = 2; j < sqrt + 1; j++) {
if (num % j == 0) {
return false;
}
}
return true;
}
private static boolean huiweishu(int i) {
int a;
if (i < 99) {
a = i / 10;
} else {
a = i / 100;
}
return a == i % 10;
}
}