Prime palindrome -- Please help

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

The link for code is :
http://www.codechef.com/viewsolution/4292176

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.

//