public class HuiWenSuShu {
public static void main(String[] args) {
printRP(100);
}
public static void printRP(int numberOfRP){
final int Num = 10;
int count = 0;
int number = 2;
while(count<numberOfRP){
if(isRP(number)&&isPR(number)){
count++;
if(count % Num == 0){
System.out.printf("%-7d\n",number);
}
else
System.out.printf("%-7d", number);
}
number++;
}
}
public static boolean isRP(int number){
for(int i = 2;i <= number / 2; i++){
if(number % i == 0){
return false;
}
}
return true;
}//判断是否是素数
public static boolean isPR(int number){
int a=number,b = 0;
while(number != 0){
b=b*10+number%10;
number=number/10;
}
return(a == b);
}//判断是否是素数
}