<span style="font-size:14px;">public class Example5.27 {
public static void main(String[] args) {
for(int i=2, count=0; count<100; i++){
int s = Palindrome(i);
if(isPrime(i)==true && isPrime(s)==true && isPalindrome(i)==false && isPalindrome(s)==false){
count++;
System.out.printf("%6d\t",i);
if(count % 10==0)
System.out.println();
}
}
}
//是否素数
public static boolean isPrime(int n){
boolean str = true;
for(int i=2; i<n/2; i++){
if(n%i == 0)
str = false;
}
return str;
}
//是否回文
public static boolean isPalindrome(int m){
int k = m;
boolean str2 = false;
int f = Palindrome(m);
//System.out.println(f);
//System.out.println(k);
if(f==k)
str2 = true;
return str2;
}
//逆数
public static int Palindrome(int p){
int w = 0;
while(p != 0){
w = w * 10 + p % 10;
p = p / 10;
}
return w;
}
}</span>