A friend recently had a birthday. His fun way of mentioning his age was to put it as a story problem, as in this tweet.

He refined the question eventually. His age was now a palindrome, but it had just been a prime number. I came back with the obvious answer: he’s 268,862 years old.

And he was curious how I came up with *that*. Specifically how I ended up in the six-digit range. The next “age” after 44 would be 212. Jumping to a number that’s outside the range of plausible human ages is the obvious joke. How I got to six digits is less obvious. But it seemed to me that if three digits is funny, then four digits must be funnier. The four-digit palindromes-succeeding-a-prime seemed boring. Five digits it is, then. Oh, but then there’s the thousands comma and that’s *not* in the middle of the number. Six digits it is. This gives you insight into why I am a humor blogger and not a *successful* humor blogger.

I didn’t go looking numbers myself, by the way. I had Octave, this open-source clone of Matlab, tell me whether numbers were prime. I just had to think of palindromic numbers.

There are a couple of plausible human ages that are palindromes-succeeding-a-prime. At least if you accept a one-digit number as a palindrome. (I don’t see a reason not to.) Those would be 3, 4, 6, 8, and 44. After that we get into numbers that humans are not likely to reach, such as 212 and 242 and 252 and 272 and 282. Then nothing until 434, 444, 464, and so on. Certainly nothing in the 500’s.

So that’s got me wondering two things, and they’re open questions. The first is, is this sequence a thing? That is, has anybody done any kind of study about palindromes-after-a-prime? I’m not saying that this is an important sequence. This is a sequence that you look at and say, “Huh” about. But there are a lot of sequences that you can mostly just say “Huh” about. That doesn’t mean we don’t know *anything* about them. I checked in the Online Encyclopedia of Integer Sequences, and found nothing. But I’m not confident in my searching ability.

The second thing is what anyone studying this sequence would first like to know. Is this an infinitely long sequence? Or is there a largest palindrome-succeeding-a-prime? My *instinct* is to say there’s not a largest. There are infinitely many prime numbers. There are infinitely many palindromic numbers. Surely the coincidence that a prime is followed by a palindrome happens infinitely often. That is *purely* a guess, however.

There could be and end to this. Consider truncatable primes, a prime number which (in base ten) is still prime if you truncate any string of its leftmost or its rightmost digits. That is, like, chop either any number of digits off the left end, or off the right end, of 3797, and you still have a prime number. There are only finitely many primes that let you do this. Specifically there are 15 (base-ten) primes that let you chop off either the left or the right side and still have a prime.

Bizarrely, if you allow only chopping off digits on the left side, there are 4,260 left-truncatable primes. If you allow only chopping off digits on the right side, there are 83. If you chop off alternating digits, one from the left side and then one from the right, then there are 920,720,315 such primes. This hasn’t anything to do with my friend’s numbers. They’re just an example that this sort of sequence can Peter out, and in unpredictable ways. Wouldn’t you have guessed there to be about as many left-truncatable as right-truncatable numbers? And fewer alternating-truncatable numbers than either? … Well, I would have, anyway.

So I don’t know. And I know that number theory problems like this have a habit of being either solvable by a tiny bit of cleverness or being basically impossible to do. No idea which this is, but someone out there might enjoy passing a dull meeting by doodling integers.

I was thinking about left-truncatable vs right-truncatable, and I think a good heuristic reason to expect more left-truncatable than right-truncatable numbers is that if you left-truncate, you know you’ll still have an admissible last digit, whereas if the digits of primes, other than the last digits, are uniformly distributed (a big if, and I don’t know if it’s true), you’re unlikely to get many primes that avoid even digits or 5, which would automatically make a right-truncated number not prime.

But I am shocked that there are so many more alternately-truncatable numbers! That seems very bizarre to me, and it sort of contradicts my left vs right heuristic. Thanks for bringing these numbers up. This is really interesting, and I’m hoping to learn more!

LikeLike