Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(Emirp) An emirp (prime spelled backward) is a nonpalindromic prime number whose

ID: 3639809 • Letter: #

Question

(Emirp) An emirp (prime spelled backward) is a nonpalindromic prime number whose reversal is also a prime. For example, 17 is a prime and 71 is a prime. So, 18 and 81 are emirps. Write a program that displays the first 100 emirps. Display 10 numbers per line and align the numbers properly, as follows:

13 17 31 37 71 73 79 97 107 113

149 157 167 179 199 311 337 347 357 389

How is this wrong?
public class Exercise05_27{
public static void main(String[] args){
{
int number = 12,number2,upto=0,i;
int[] prime = new int[100];

while(upto<100)
{
if(!check(number,prime,upto))
if(isPrime(number))
{
number2 = reverse(number);
if(number2 != number)
if(!check(number2,prime,upto))
if(isPrime(number2))
upto = insert(number,number2,prime,upto);
}
number++;
}
sort(prime,upto);
for(i = 0;i < 100;i++)
{
if(i%10 == 0)
System.out.println();
System.out.printf("%7d",prime[i]);
}
}
}
public static void sort(int a[],int n)
{
int i,j,t;
for(i = 0;i < n-1;i++)
for(j = i;j < n;j++)
if(a[i] > a[j])
{
t = a[i];
a[i] = a[j];
a[j] = t;
}
}
public static boolean check(int n,int a[],int c)
{
int i;
for(i = 0;i < c;i++)
if(a[i] == n)
return true;
return false;
}
public static int insert(int n,int m,int a[],int i)
{
a[i++] = n;
a[i++] = m;
return i;
}
public static int reverse(int n)
{
int newnum = 0;
while(n > 0)
{
newnum = newnum*10 + n%10;
n = n/10;
}
return newnum;
}
public static boolean isPrime(int n)
{
int i;
for(i = 2;i < n;i++)
if(n%i == 0)
return false;
return true;
}
}

Explanation / Answer

please rate - thanks

output of program

list from http://oeis.org/A006567/list

explain to me what's wrong and I'll fix it. don't just say it's wrong. I see nothing wrong