// A number with odd number of digits and zero in the center is cyclops number
public class MyClass {
private static boolean isCyclopsNumber(int n) {
if (n == 0) {
return true;
}
int m = n % 10;
int count = 0;
while (m != 0) {
count++;
n /= 10;
m = n % 10;
}
n /= 10;
m = n % 10;
while (m != 0) {
count--;
n /= 10;
m = n % 10;
}
return n == 0 && count == 0;
}
private static boolean isPrime(int n) {
if (n < 2 || (n % 2 == 0 && n != 2)) {
return false;
}
int count = (int)Math.floor(Math.sqrt(n));
for (int i = 3; i <= count; i += 2) {
if (n % i == 0) {
return false;
}
}
return true;
}
public static void main(String args[]) {
int n = 209;
System.out.println(isCyclopsNumber(n) && isPrime(n) ? "yes" : "no");
n = 503;
System.out.println(isCyclopsNumber(n) && isPrime(n) ? "yes" : "no");
}
}
/*
run:
no
yes
*/