The other day, Futility Closet posted this observation:

10102323454577 is the smallest 14-digit prime number that follows the rhyme scheme of a Shakespearean sonnet (ababcdcdefefgg).

I posted this on AlgebraFact and got a lot of responses. One was from Matt Parker who replied that 11551 was the smallest prime with a limerick rhyme scheme.

So how many limerick primes are there? Well, there aren’t many candidates. A limerick prime has to have the form AABBA where A is an odd digit and B is any digit other than A. So for each of five choices of A, there are nine possible B’s. Here’s a Mathematica program to do a brute force search for limerick primes.

For[ j = 0, j < 5, j++, For[ k = 0, k < 10, k++, x = (2 j + 1)*11001 + 110 k; If[ PrimeQ[x], Print[x] ]]]

It turns out there are eight limerick primes:

- 11551
- 33113
- 33223
- 33773
- 77447
- 77557
- 99119
- 99559

See the next post for Mathematica code to list all sonnet primes.

**Related posts**:

Divisibility by 7

Odd perfect numbers

Twin prime conjecture and the Pentium division bug

Incidentally, 99559 are the number of syllables per line in a limerick.

Thats really cool and it takes me back to my youth …

One of my first forays into numerical computing was an implementation of the Sieve of Eratosthenes in graphics memory (for space) to ennumerate primes. I noticed that 16661 was prime and then limited the output to palindromic primes. I happened to notice that all of the palindromic primes except 11 had an odd number of digits. That inspired my first mathematical proof — that 11 is the only palindromic prime with an even number of digits.

What if you consider 2 digits for a and b like AABBA = 13 13 12 12 13?

Here are additional limerick primes for A and B < 20,

7710107, 7713137, 7719197, 9913139, 9916169, 9919199, 1111202011,13134413, 13138813, 17172217, 17177717, 1717202017, 19191119, 19192219, 19194419, 1919111119, 1919161619, 1919171719.

Wishing I had time today to compose an appropriate limerick in response.

Two quintillion, seventy-seven

Quadrillion, three hundred eleven

Trillion, one billion,

Twenty-four million,

One thousand two hundred and seven.

Andrew’s prime above is 2077311001024001207 for those who, like me, might need to look up the meaning of quintillion or quadrillion.