Calculating expected number of attempts to find a large palindromic prime in digits of $\pi$

91 Views Asked by At

I want to find the greatest palindromic prime in the known digits of $\pi$. Currently there are $100$ trillion digits calculated. There are $9$ trillion palindromic primes of $25$ digits, and the proportion of primes in numbers with $25$ digits is about $1$ in $\log(10^{25}) \approx 58$. So the chances that a random $25$ digit number will be a palindromic prime is about $1$ in $58$ trillion. Based on this, I've estimated the chance that at least one palindromic prime is found within the first $100$ trillion digits of $\pi$ to be about $$1-\left(1 - \frac{1}{57564627324851} \right)^{10^{14}} \approx 82.3 \%$$

Similarly, the odds if we were to ask for a palindromic prime of $27$ digits is about $14\%$. And it is very likely ($>99\%$ chances) that no palindromic prime of $29$ digits occurs.

This, however, doesn't really help me that much. I think there will probably be multiple palindromic primes of $25$ digits within the first $100$ trillion digits, but I don't know how to calculate the expected number of attempts until we find the first one. It may very well occur before $20$ trillion digits, for instance (the odds in that case are greater than $20\%$). So what I would really like some help with is finding out the following (you can assume in all of the questions below that $\pi$ is a normal number):

  • What is the expected number of digits until we find the first palindromic prime of $(2n+1)$ digits within its decimal expansion?

  • What is the expected amount of prime palindromes with $(2n+1)$ digits we can find within the first $10^k$ digits?

  • How far apart can we expect the aforementioned palindromic primes to be?

I know there is nothing special about $\pi$ here, it could be just a random string of $100$ trillion digits. But I purposely mentioned it just to make things more concrete. I appreciate any help! Thanks in advance.