Skip to main content

What the Prime Number Tweetbot Taught Me about Infinite Sums

Sometimes we learn math from lectures and textbooks. Sometimes it's Web comics and Twitter

This article was published in Scientific American’s former blog network and reflects the views of the author, not necessarily those of Scientific American


Last summer, Zach Weinersmith of smbc comicsblew my mind.

None

Image: Zach Weinersmith, smbc comics. Click here for original.

My reaction was basically in line with the bottom right panel:


On supporting science journalism

If you're enjoying this article, consider supporting our award-winning journalism by subscribing. By purchasing a subscription you are helping to ensure the future of impactful stories about the discoveries and ideas shaping our world today.


The harmonic series grows to infinity unless you throw out numbers with a 9 in their denominator.

"Sometimes thWHAT? WHAT? But how in the…WHAT THE BALLS?!”

The harmonic series is the infinite sum 1+1/2+1/3+1/4+…, the sum of the reciprocals of every positive integer. Even though the terms get closer and closer to 0, the series goes to infinity, meaning it eventually gets bigger than any number you can throw at it. (The question is fun to think about, so I won’t spoil it for you, but Wikipedia has an explanation.)

It seems baffling that if we take away 1/9, 1/19, 1/29, and so on, the series converges instead. In fact, it's less than 90, which is frankly pitiful compared to the infinitude of the harmonic series. 

One ingredient in making sense of this mystery is a puzzling fact: "most" large numbers have a 9 in them, so eventually you're throwing out an awful lot of the numbers from the harmonic series. This fact seems very strange to me because the intuition I have about numbers, primarily based on the one- and two-digit numbers we encounter the most, fails me. Based on those small numbers, it feels like only a little over 10% of numbers have a 9 in them. But that’s spectacularly incorrect: as the number of digits increases, it becomes virtually certain that a randomly selected number will have a 9 as one of its digits.

It's not too hard to see why most large numbers have a 9 in them. Like a lot of probability puzzles, most famously the birthday problem, you can approach the question from the opposite direction. In this case, instead of directly figuring out how many numbers there are of a certain size and how many contain a 9, I can compute the probability that a given large number does not have a 9 in it.

Except for the first digit, which can’t be 0, there’s a 9/10 chance that any one digit in a multi-digit number is not a 9. (There’s an 8/9 chance that the first digit is not a 9.) So for a 2-digit number, there’s an 8/9×9/10, or 80%, chance that it doesn’t have a a 9 in it. For a 10-digit number, on the other hand, there’s an 8/9×(9/10)9 chance that it doesn’t have any nines. This is a much smaller chance, only about 34%. When we get up to 100 digits, there is less than a 0.01% chance that a randomly selected number is nine-less.

I can write that proof down, but my intuition for numbers gets in the way of my deeper understanding. Enter the prime tweetbot. Last summer I wrote about how much more interested I am in number theory than I used to be, and I think @_primes_ deserves a lot of the credit. Every hour, this bot tweets the next prime number. I enjoy scrolling through and retweeting the primes I find pleasing in some way.

In addition to helping me appreciate the aesthetic beauty of prime numbers, @_primes_ has helped me understand the nine-less harmonic series. When I last checked, of the 10 most recent prime numbers it had tweeted, 6 of them had a 9 in them. If you select any digit and scroll through the numbers, you’ll find the digit more often than your intuition might lead you to believe. You might have runs where one digit doesn’t appear for a while, but those are balanced by the long strings where they do appear. (For example, all the recent primes have a 2, 5, and 6 in them, and they will stay that way for a while.)

After noticing how many times each digit pops up on the prime number tweetbot, the idea that most big numbers do contain any individual digit just clicked into place. I'm actually not sure how I feel about that. On the one hand, it's satisfying to feel like I finally understand something that used to mystify me. On the other hand, there's one less thing in the world that makes me say "What the balls?!"