10152 - 回文质数

因为151即是一个质数又是一个回文数(从左到右和从右到左是看一样的),所以 151 号是回文质数。 写一个程序来找出范围[a,b](5 <= a < b <= 100,000,000)间的所有回文质数;

输入

第 1 行: 二个整数 a 和 b .

输出

输出一个回文质数的列表,一行一个。

样例

输入

5 500

输出

5
7
11
101
131
151
181
191
313
353
373
383

提示

Prime Palindromes The number 151 is a prime palindrome because it is both a prime number and a palindrome (it is the same number when read forward as backward). Write a program that finds all prime palindromes in the range of two supplied numbers a and b (5 <= a < b <= 100,000,000); both a and b are considered to be within the range .

PROGRAM NAME: pprime INPUT FORMAT Line 1: Two integers, a and b

SAMPLE INPUT (file pprime.in) 5 500

OUTPUT FORMAT The list of palindromic primes in numerical order, one per line. SAMPLE OUTPUT (file pprime.out) 5 7 11 101 131 151 181 191 313 353 373 383

HINTS (use them carefully!)

   HINT 1          HINT 2   
时间限制 1 秒
内存限制 128 MB
讨论 统计
上一题 下一题