The probability that a prime is less than the number formed by reversing its digits

elementary-number-theorylimitsnumber theoryprime numberssequences-and-series

Let $p_n$ ne the $n$-th prime and let $r_n$ be the number formed by reversing the digits of $p_n$ in base $10$ notation. All prime numbers greater than $5$ end in $1,3,7$ or $9$.

Take the first $n$ primes, count the number of primes $r(n)$ of them which are less than the number formed by their reverse. To what limiting value does $\dfrac{r(n)}{n}$ converge to as $n \to \infty$ or does it exist in the first place?

It is easy to evaluate this for primes whose first and last digits are different. However when primes begin and end with the same digit then we have to consider all the intermediate digits. Experimental data shows that the limiting value may not exist and oscillate between $0.506$ and $0.707$.

Best Answer

This limit doesn't exist; the proportion oscillates because the highest numbers dominate it. For instance, for $p_n\approx5\cdot10^k$, most numbers will be less than their reversed versions, simply because they start with a digit from $1$ to $4$, whereas for $p_n\approx10^k$ the proportion will be roughly $\frac12$.

Instead, you should consider the logarithmic density, which weights each range $\left[10^n,10^{n+1}\right]$ equally.

By the prime number theorem for arithmetic progressions, the primes are asymptotically equidistributed over the admissible residue classes mod $10^k$. Thus, $\frac14$ of them end in each of $1,3,7,9$, the ones ending in $1$ are equidistributed with respect to ending in $01,11,\ldots,91$, and so on. Thus, the reversed version of a prime is effectively a random number with the first digit uniformly randomly drawn from $1,3,7,9$ and the following digits uniformly randomly drawn from all digits. A number $x$ distributed in $\left[10^n,10^{n+1}\right]$ with density $\frac1{x\log10}$ thus has the following probability to be less than its reversed version:

\begin{eqnarray} && \frac1{4\log10}\left(\int_1^2\frac{2-x}x\mathrm dx+\log3+\int_3^4\frac{4-x}x\mathrm dx\\+\log7+\int_7^8\frac{8-x}x\mathrm dx+\log9+\int_9^{10}\frac{10-x}x\mathrm dx\right) \\ &=& \frac{2\log2+\log7+8\log2-4\log3+24\log2-8\log7+\log9+9\log10-18\log3-4}{4\log10} \\ &=& \frac{43\log2-20\log3+9\log5-7\log7-4}{4\log10} \\ &\approx& 0.5099\;. \end{eqnarray}

This is the logarithmic density of the primes that are less than their reversed versions.

Related Question