J.Emirp | |||||
| |||||
Description | |||||
An emirp (prime spelled backwards) is a prime number that results in a different prime when its decimal digits are reversed. The first five emirps are 13, 17, 31, 37, 71 Now Kim want to know the kth emirp. Help him. | |||||
Input | |||||
The first line is an integer T, describes the number of tests. Then T tests. In each test, one line an integer k. | |||||
Output | |||||
For each test, output the kth emirp. | |||||
Sample Input | |||||
3 1 2 3 | |||||
Sample Output | |||||
13 17 31 | |||||
Hint | |||||
T<=10000 k<=1000 枚举每个数,并把它翻过来判断是不是素数。最终的答案不会很大,第1000个emirp也就70000左右。
|
Emirp
最新推荐文章于 2023-04-12 21:33:15 发布