import java.math.BigInteger;
import java.util.*;
class Main {
public static void main(String[] args){
Scanner in=new Scanner(System.in);
while(in.hasNext()){
BigInteger n=in.nextBigInteger();
if(n.isProbablePrime(15)){
StringBuilder s1=new StringBuilder(n.toString());
StringBuilder s2=s1.reverse();
BigInteger n2=new BigInteger(s2.toString());
if(n.equals(n2)==false){
if(n2.isProbablePrime(15))
System.out.println(n+" is emirp.");
else
System.out.println(n+" is prime.");
}
else
System.out.println(n+" is prime.");
}
else{
System.out.println(n+" is not prime.");
}
}
}
}
import java.util.*;
class Main {
public static void main(String[] args){
Scanner in=new Scanner(System.in);
while(in.hasNext()){
BigInteger n=in.nextBigInteger();
if(n.isProbablePrime(15)){
StringBuilder s1=new StringBuilder(n.toString());
StringBuilder s2=s1.reverse();
BigInteger n2=new BigInteger(s2.toString());
if(n.equals(n2)==false){
if(n2.isProbablePrime(15))
System.out.println(n+" is emirp.");
else
System.out.println(n+" is prime.");
}
else
System.out.println(n+" is prime.");
}
else{
System.out.println(n+" is not prime.");
}
}
}
}
Comments
Post a Comment