## Prime Curio Redux

*March 14, 2011 at 9:15 pm* *
4 comments *

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.

Entry filed under: Uncategorized. Tags: beast number, circle digit, palindrome, postaweek2011, prime, probability.

1.Veky | March 15, 2011 at 3:02 am… if those events would be independent, which obviously they aren’t. For example, if it has an embedded 666, you already have three digits containing circles. In other words, proportion of numbers containing 666 is much greater within numbers with circle-digits, than within all numbers.

2.venneblock | March 15, 2011 at 9:14 pmYep, I assumed independence to keep the calculations easy. You’re right that this slightly overcounts things.

3.Joshua Zucker | March 15, 2011 at 4:41 amI’m pretty sure your formula for counting beast numbers is wrong. Looks like you forgot to subtract the ones that have two separate groups of 666 in them (or rather, you counted them twice if they have two separate groups of 666)?

For example, there are only 42291 seven-digit beast numbers but your formula gives 42300. There are only 503748 eight-digit beast numbers but your formula gives 504000.

4.venneblock | March 15, 2011 at 9:16 pmOh, shoot! You’re right! I’ll take some solace in the fact that I didn’t overcount by much, but I’ll have to re-work that part. Maybe there’s not a general formula, and I’ll just have to do all the hard work by hand… did you come up with a formula, or did you just count?