## Archive for March 14, 2011

### Prime Curio Redux

As I mentioned in yesterday’s review of *Prime Curios*, the book contains a lot of interesting facts about prime numbers. In fact, it contains so many intereting tidbits that I was still reading three hours after posting my review. On page 202, I discovered a rather interesting curio:

968,666,869

The smallest palindromic prime with embedded beast number whose digits contain circles, i.e., using only the digits 0, 6, 8, 9.

What struck me about this curio was the embarassingly small size of the set under consideration. If you consider the four subcategories contained within the description — prime, palindrome, embedded beast number, and using only the digits 0, 6, 8, and 9 — the intersection of those groups is miniscule.

Consider each piece in turn. To limit the discussion, let’s only worry about integers less than one billion, since the prime number described above falls below that threshold.

**Prime**

Rumor has it that there are 50,847,478 prime numbers less than 1,000,000,000. (That value seems reasonable, given that the Prime Number Theorem suggests that there should be about 10^{9}/ln(10^{9}) ≈ 48,254,952.) In other words, about 5.084% of the positive integers up to 1,000,000,000 are prime.

**Palindrome**

In general, there are 9 × 10^{[(n + 1)/2]} palidromes with *n* digits. That means that are there 9 + 9 + 90 + 90 + 900 + 900 + 9,000 + 9,000 + 90,000 + 90,000 = 199,998 palindromes less than 1,000,000,000. In other words, less than 0.020% of those numbers are palindromes.

**Embedded Beast Number**

Analyzing this part was pretty cool. How many numbers less than 1,000,000,000 have an embedded beast number, that is, how many numbers have a string of three consecutive 6’s? It took about an hour of playing to find a general formula. For positive integers with *n* digits, the number of positive integers with an embedded beast number is:

10^{n – 3} + 8 × 10^{n – 4} + (*n* – 4)(9^{2} × 10^{n – 5})

That formula revealed that there are 6,400,000 positive integers with an embedded beast number less than 1,000,000,000, or only about 0.640%.

[**update – 3/16/2011**]

As noted by Joshua Zucker in the comments, this formula is incorrect. It fails to remove numbers that have more than one string of three consecutive 6’s. As Josh noted, there are only 42,291 seven‑digit beast numbers (the formula gives 42,300), and there are only 503,748 eight‑digit beast numbers (the formula gives 504,000). I will try to correct this within the next several days.

**Circle Digits**

If the digits in a number are limited to just 0, 6, 8, and 9, then there are 262,143 positive integers with only circle digits less than 1,000,000,000, or a mere 0.026%.

So, what does all this nonsense get us? It says that the probability of a positive integer less than one billion being a palindromic prime with embedded beast number whose digits contain circles is approximately

*P* = 0.05084 × 0.00020 × 0.00640 × 0.00026 = 0.000 000 000 019 523,

or, in layman’s terms, really frickin’ small.

With the odds at about 1 in 50,000,000,000, it’s no suprise that the first occurrence of this type of number is just shy of a billion at 968,666,869.