An emirp (prime spelled backwards) is a prime number that results in a different prime when its digits are reversed.[1] This definition excludes the related palindromic primes. Emirps are also called reversible primes.
this are the list of emirps
http://oeis.org/A006567/list
public class EmirpProgram {
public static void main(String args[]){
int a = 13;
int count = 0;
while(count<100){
if(isEmirp(a)){
System.out.print(a + " ");
count++;
if(count%10==0)
System.out.println();
}
a++;
}
}
public static boolean isPrime(int p){
for(int i=2;i <p; i++){
if( p%i==0){
return false;
}
}
return true;
}
public static boolean isEmirp(int x){
return isPrime(x) && isPrime(reverse(x));
}
public static int reverse(int r){
if(r<10)
return r;
return flipper(r%10,r/10);
}
public static int flipper(int a, int b){
if(b<1)
return a;
return flipper(a*10+b%10,b/10);
}
}
here is my output
13 17 31 37 71 73 79 97 101 107
113 131 149 151 157 167 179 181 191 199
311 313 337 347 353 359 373 383 389 701
709 727 733 739 743 751 757 761 769 787
797 907 919 929 937 941 953 967 971 983
991 1009 1021 1031 1033 1061 1069 1091 1097 1103
1109 1151 1153 1181 1193 1201 1213 1217 1223 1229
1231 1237 1249 1259 1279 1283 1301 1321 1381 1399
1409 1429 1439 1453 1471 1487 1499 1511 1523 1559
1583 1597 1601 1619 1657 1669 1723 1733 1741 1753
some numbers are right and some arent, no numbers are missing tho just extras
what did I do wrong