There are many mistakes in your code which have to be corrected.

1)BE CAREFUL WITH WHAT YOU OUTPUT.

your code does not output what the problem asks you to output. ie) given n ,your output must be the smallest prime palindrome>=n.for ex if the input is 1000000 then output must be 1003001.but this is not what your code outputs.it outputs the foll:

OUTPUT:

1000000

1000001

1001001

1002001

1003001 1003001

i corrected the error.but still your code shows wa for the foll inputs:

input:

2

your output:

11

correct o/p:

2

input:

101

your o/p:

131

correct o/p:

101

So,as far my observation,your code gives wrong answer for all nos from 1 to 10.and for nos greater than 10,it gives wrong answer if the i/p no itself is a prime palindrome as in the case of 101 ie)it checks for the smallest prime palindrome >n,but it should check for smallest prime palindrome >=n.

i think the mistake lies in the palindrome generation part,check for error in that part.HAPPY CODING