#K93322. Nth Palindromic Prime
Nth Palindromic Prime
Nth Palindromic Prime
In this problem, you are given several queries and for each query, you need to compute the nth palindromic prime. A palindromic number is one that remains the same when its digits are reversed, and a prime number is a number greater than 1 that has no positive divisors other than 1 and itself. Formally, a number (X) is palindromic if (X = \text{reverse}(X)) and prime if it has exactly two distinct positive divisors. For example, the palindromic primes start as (2, 3, 5, 7, 11, 101, \dots). Your task is to output the nth palindromic prime for each test case.
inputFormat
The input is read from standard input. The first line contains an integer (q) ((1 \le q \le 100)) representing the number of test cases. The next line contains (q) space-separated positive integers, where each integer (n) ((1 \le n \le 1000)) indicates that you should find the nth palindromic prime.
outputFormat
For each test case, output the nth palindromic prime on a separate line to standard output.## sample
5
1 2 3 4 5
2
3
5
7
11
</p>