First palindromic numbers P12848


Statement
 

pdf   zip

thehtml

Remember that a natural number is called prime if and only if has only two divisors: 1 and itself. Moreover, a natural number is called palindromic if its value is the same when its digits are reversed. For instance, 146641 is a palindromic number but 164361 is not.

Write a program that prints the i-th prime palindromic number.

Input

Input is a sequence of integer numbers between 1 and 750 (both included).

Output

For each integer i of the sequence, print in a line with the i-th prime palindromic number.

Public test cases
  • Input

    1
    2
    3
    4
    5
    6
    750
    749
    750
    
    

    Output

    2
    3
    5
    7
    11
    101
    9817189
    9809089
    9817189
    
  • Information
    Author
    Jordi Petit
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++