# Why is the reverse of a prime about $45\%$ more likely to be a prime than that of a composite?

Consider two cases a) we reverse the digits of a prime number b) we reverse the digits of a composite number. Are we more likely to obtain a prime in case a) or in case b). Since the last digit of primes other than $$2$$and $$5$$ end in $$1,3,7$$ or $$9$$ hence if a prime or composite number begins in $$2,4,5, 6$$ or $$8$$ there is no way its reverse will be a prime. So to make a fair comparison, I only considered those prime and composite numbers whose first and last digits is $$1,3,7$$ or $$9$$.

Let $$C$$ and $$P$$ be the set of such composites and prime numbers respectively. I looked at the first $$10^8$$ numbers (in ascending order) in $$C$$ and observed the density of numbers whose reverse is a prime is roughly $$\frac{2.4n}{\log n}$$. However in case of the set $$P$$, the density of roughly $$\frac{3.5n}{\log n}$$ i.e. about $$45\%$$ higher which is significant.

Question: Given the set of numbers whose first and last digits is $$1,3,7$$ or $$9$$, why is the reverse of a prime about $$45\%$$ more likely to be a prime than that of a composite?

• If a composite is divisible by $3$, then also its reverse. This could be one reason. But I wonder why this does not cause an even stronger effect. Apr 7, 2021 at 8:10
• @Peter The effect could be slightly bigger. My computing is still running and at the moment, the coefficient is oscillating roughly between $3.45 - 3.55$. But I don't think it would be significantly bigger. Apr 7, 2021 at 8:18
• Reverses of multiples of 11 are still multiples of 11.
– MJD
Apr 7, 2021 at 8:39
• I wonder how the result changes when one goes to base 2, etc. That may give some insight on importance of the base $\pm1$, I don't know... Apr 7, 2021 at 8:46
• Reverses of multiples of 10001 are all multiples of 10001. I think in other bases, numbers like this might be more common than in base 10.
– MJD
Apr 7, 2021 at 9:18

## 1 Answer

1. If a composite number is divisible by 3, the sum of its digits is also divisible by 3.

2. If a composite number is divisible by 11, the alternating sum of its digits is also divisible by 11.

Just two of those facts will give you a $$\frac13+\frac1{11}=43\%$$ better chance. You can further increase this number by starting adding up rarer cases. For example, if the number of digits in $$p$$ is a multiple of 3, then if $$p = \overline{a_1a_2a_3a_4a_5a_6\ldots}$$ is divisible by 7, then $$(a_1+2a_2+a_3)+(a_4+2a_5+a_6)+...$$ is also divisible by 7.

• plus if you keep it odd, your mixture of $\{1,4,7\}$ and $\{2,5,8\}$ the same creates another number with the same remwinder on division by 6 ... Apr 7, 2021 at 10:31
• You need $\frac13+\frac1{11} -\frac1{33}$ or you have double-counted the multiples of $33$.
– MJD
Apr 7, 2021 at 15:24
• It took me this long to realize that the reverse of a prime is also never a multiple of $10$, so $\frac13+\frac1{10}+\frac1{11}-\frac1{30}-\frac1{33}-\frac1{110}+\frac1{330}=\frac5{11}=45.45\ldots\%$
– MJD
Dec 13, 2021 at 13:20