Why are you using the 2 while loops for checking if a number is a palindrome.
Here, it can be done in 1 loop,
int palin(int n)
After correcting this also you are not going to get correct answer, you need to optimize the code.
Now, use this algorithm:
First generate all primes till sqrt(1030000) (And try to use an efficient algorithm for this)
Check if temp is palindrome
If (temp is palindrome)
check if i is prime
//For checking i as prime divide with all primes till the sqrt(i)( no need to divide with all numbers
//till number/2 )
If(i is prime and palin)
**Use a good method to generate primes.**