I'm trying to complete a coding challenge that involves finding large palindromic primes in the decimal expansion of $\pi$. I'm at the second stage of this challenge, which asks me to find the first palindromic prime of $21$ digits in the decimal expansion of $\pi$. The first stage was finding the first $9$-digit palindromic prime, which is $318272813$, and starts at the $129078$-th digit, not counting the beginning "3." of the expansion "3.1415...". I'm looking for ways to solve this which don't involve brute force/lookup tables.
The way I solved the first one was by the dumbest possible solution: look at the number formed from digits $1$ through $9$ and check if it is a palindromic prime - if not, look at the number formed from digits $2$ through $10$ and check again... so on and so on, until we get the desired palindromic prime and stop this process. There has gotta be a smarter way to go about this though. The way I solved the first stage does not scale.
I had some other potential smarter solutions, but I think they're not gonna help me much either: there are 90 billion palindromes of 21 digits. We can go through all of them and make a list of the prime ones and then look for them in the decimal expansion (noting also that right off the bat we can rule out 50 billion of them because they gotta start/end with either a $1$, $3$, $7$ or $9$). I think this might be a faster way than the raw brute force I described previously but I'm not sure, and this is pretty dumb too.
Does anyone have anything else in mind that can help?