You're reading: Travels in a Mathematical World

Primes, reversals and concatenations

In the last Finite Group livestream, Katie told us about emirps. If a number p is prime, and reversing its digits is also prime, the reversal is an emirp (‘prime’ backwards, geddit?).

For example, 13, 3541 and 9999713 are prime. Reversing their digits we get the primes 31, 1453 and 3179999, so these are all emirps. It doesn’t work for all primes – for example, 19 is prime, but 91 is \(7 \times 13 \).

In the livestream chat the concept of primemirp emerged. This would be a concatenation of a prime with its emirp. There’s a niggle here: just like in the word ‘primemirp’ the ‘e’ is both the end of ‘prime’ and the start of ’emirp’, so too in the number the middle digit is end of the prime and the start of its emirp.

Why? Say the digits of a prime number are \( a_1 a_2 \dots a_n \), and its reversal \( a_n \dots a_2 a_1 \) is also a prime. Then the straight concatenation would be \( a_1 a_2 \dots a_n a_n \dots a_2 a_1 \). Each number \(a_i\) is in an even numbered place and an odd numbered place. Now, since

\[ 10^k \pmod{11} = \begin{cases}
10, & \text{if } k \text{ is even;}\\
1, & \text{otherwise,}
\end{cases} \]

it follows that each \(a_i \) contributes a multiple of eleven to the concatenation. A mismatched central digit breaks this pattern, allowing for the possibility of a prime.

I wrote some code to search for primemirps by finding primes, reversing them and checking whether they were emirps, then concatenating them and checking the concatenation. I found a few! Then I did what is perfectly natural to do when a sequence of integers appears in front of you – I put it into the OEIS search box.

Imagine my surprise to learn that the concept exists and is already included in the OEIS! It was added by Patrick De Geest in February 2000, based on an idea from G. L. Honaker, Jr. But there was no program code to find these primes and only the first 32 examples were given. I edited the entry to include a Python program to search for primemirps and added entries up to the 8,668th, which I believe is all primemirps where the underlying prime is less than ten million. My edits to the entry just went live at A054218: Palindromic primes of the form ‘primemirp’.

The 8,668th primemirp is 9,999,713,179,999.

(will not be published)

$\LaTeX$: You can use LaTeX in your comments. e.g. $ e^{\pi i} $ for inline maths; \[ e^{\pi i} \] for display-mode (on its own line) maths.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>