Prime palindrome -- Please help

I am getting wrong answer.Please help me find out the error.

The link for code is :
CodeChef: Practical coding for everyone

Thanks :slight_smile:

For any input near less or equal to 10^6, what will be the answer?

It is given that input is less than 10^6. Answer could be greater than this.