2015 German Collegiate Programming Contest (GCPC)
Upside down primes
Last night, I must have dropped my alarm clock. When the alarm went off in the morning, it showed 51:80 instead of 08:15. This made me realize that if you rotate a seven segment display like it is used in digital clocks by 180 degrees, some numbers still are numbers after turning them upside down.
Prime number 18115211 on a seven segment display (see third sample).
18115211 turned upside down (i.e. rotated by 180 degrees) gives 11251181, which is not prime.
As you can see,
My favourite numbers are primes, of course. Your job is to check whether a number is a prime and still a prime when turned upside down.
One line with the integer n in question (1 ≤ n ≤
1016). n will not have leading zeros.
Print one line of output containing "yes" if the number is a prime and still a prime if turned upside down, "no" otherwise.