#P1217. Palindromic Primes in Range

    ID: 14272 Type: Default 1000ms 256MiB

Palindromic Primes in Range

Palindromic Primes in Range

A palindromic prime is a prime number that remains the same when its digits are reversed, i.e., it is a palindrome. For example, since \(151\) is both prime and a palindrome, it is a palindromic prime.

Your task is to write a program that finds all palindromic primes in the interval \([a, b]\), where \(5 \le a < b \le 100{,}000{,}000\).

inputFormat

The input consists of two space-separated integers \(a\) and \(b\) satisfying \(5 \le a < b \le 100{,}000{,}000\).

outputFormat

Output all palindromic prime numbers in the interval \([a, b]\) (inclusive) in ascending order, each printed on a new line.

sample

5 50
5

7 11

</p>