1. Home
  2. Explore
  3. Mathematics
  4. Prime Number Race

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Prime Number Race

Speaker 1Speaker 2

Prime Number Race

11:53
0:00-11:53
  1. Michael

    Hey everyone, welcome back to the podcast! This is actually the third part of a series we're doing on sequences that behave in unexpected ways, featuring insights from Grant Sanderson of 3Blue1Brown. You don't necessarily need to have watched the first two, but they're there if you want the full experience.

  2. Anna

    That sounds intriguing! So, what unexpected sequence are we diving into today? I'm always fascinated by how numbers can surprise us, especially when they seem to follow a certain pattern and then suddenly deviate or show a hidden bias.

  3. Michael

    Today, we're looking at a 'race' between prime numbers. We're dividing them into two teams: those that are 1 mod 4, meaning they leave a remainder of 1 when divided by 4, and those that are 3 mod 4. We're essentially just counting which team has more primes as we go along the number line.

  4. Anna

    Okay, a prime number race! That's a fun way to put it. So, just to clarify, primes like 5, 13, and 17 would be on Team 1, because 5 divided by 4 is 1 with a remainder of 1, and so on. And primes like 3, 7, and 11 would be on Team 3, right?

  5. Michael

    Exactly. We actually disqualify the prime number 2 because it's the only even prime, so it doesn't fit the pattern of the others. But yes, those are the teams. And what's really interesting is how this race unfolds initially.

  6. Anna

    So, as we start counting, like 3 (Team 3), then 5 (Team 1), then 7 (Team 3), 11 (Team 3), 13 (Team 1), 17 (Team 1)... it sounds pretty close at the beginning. Is there an early leader or does it just bounce back and forth?

  7. Michael

    That's the initial perception, but if you actually keep a running tally, you'd notice that Team 3 consistently stays in the lead. For example, after 17, we get 19 (Team 3) and 23 (Team 3), then 29 (Team 1), and 31 (Team 3). Team 3 is ahead.

  8. Anna

    Wow, so even though it seems like they should be neck and neck, Team 3 pulls ahead early on. You'd think that with a large enough sample of primes, it would even out to be roughly 50/50, or at least very close. Does this trend continue for a long time?

  9. Michael

    It does, for a remarkably long time. Team 3 maintains the lead almost continuously. The first time Team 1 actually breaks into the lead is at the prime 26,861. But even then, it's just a brief moment, and Team 3 quickly regains the lead.

  10. Anna

    That's an incredibly specific number! 26,861. And it's only a temporary lead for Team 1? So, for the vast majority of primes, Team 3 is dominant. How long does that dominance last after the first swap?

  11. Michael

    Team 3 holds the lead again for a substantial period. The next time Team 1 manages to get ahead isn't until 616,841. Even then, it's temporary again. What we see is that for most numbers, about 99% of the time, Team 3 is in the lead.

  12. Anna

    99% of the time? That's a huge bias! You would absolutely expect a 50/50 split if it were truly random, or at least a much closer distribution. So, this led to a conjecture, I assume, about whether this percentage approaches 100% as we look at more and more primes?

  13. Michael

    Precisely. The conjecture was: as 'n' tends to infinity, does the percentage of the time that Team 3 is in the lead approach 100%? It's a fascinating question, because if there's a reason for more 3 mod 4 primes, you might expect it to either be completely 50/50 or lean entirely towards one side.

  14. Anna

    My intuition tells me that primes shouldn't have such a strong bias. Once you account for obvious things, like only 2 being even, their distribution often feels random. Why would one 'team' have such a consistent advantage over the other?

  15. Michael

    You're right, it feels counter-intuitive. We often use a heuristic that, after ruling out obvious divisibility constraints, prime behavior feels random. This heuristic is surprisingly useful for many conjectures, but here, something else is at play.

  16. Anna

    So, is there a similar phenomenon with other prime classifications? Like, if we looked at the last digits of primes? Primes can end in 1, 3, 7, or 9. Do those also have an unexpected bias or do they actually settle around 25% each?

  17. Michael

    That's a great question! If you perform that race for the last digits of primes – 1, 3, 7, or 9 – in the long run, they all tend towards about 25% each. However, even there, two of them tend to be slight winners, even if just by a little bit. There's a gentle bias.

  18. Anna

    A gentle bias even there, for last digits. It seems primes aren't as 'random' as we might initially think. But back to the 3 mod 4 vs. 1 mod 4 race: has that strong bias for Team 3 actually been proven, or is it still just a conjecture?

  19. Michael

    That's an excellent question, and it's something we'll get to at the very end. For now, let's treat it as a conjecture with strong empirical evidence. It's incredibly tricky to prove something like this, and the actual answer is quite surprising, which we'll unveil shortly.

  20. Anna

    Okay, you're building the suspense! So, before we get to the proof, or lack thereof, what's the intuition behind why this bias might exist? Is there some mathematical principle that secretly favors primes that are 3 mod 4?

  21. Michael

    Yes, there is a satisfying intuition, provided you're willing to accept one 'magical fact.' It starts with a famous formula for Pi: 1 minus 1/3 plus 1/5 minus 1/7, and so on, toggling signs for all odd numbers.

  22. Anna

    Ah, the Leibniz formula for Pi/4! I'm familiar with that series. So, it's not just primes, but all odd numbers in this initial setup. How does that connect to our prime number race? And what's this 'magical fact' you mentioned?

  23. Michael

    Well, we can define a function, let's call it chi of n, which is +1 if n is 1 mod 4, -1 if n is 3 mod 4, and 0 if n is even. So, the series for Pi/4 is essentially the sum of chi of n divided by n. The magical fact comes from number theory's unique way to take a logarithm of such a series.

  24. Anna

    Okay, so we're reformulating the Pi/4 series using this chi function. And then we apply a 'logarithm trick' to it? That sounds like something that simplifies things, but you also mentioned kicking out composite numbers and punishing prime powers. How does that work?

  25. Michael

    The trick only works if the series terms have a multiplicative property where the term for a product of numbers is the product of their individual terms. When you apply this 'logarithm,' you essentially transform the series by getting rid of composite numbers and reducing prime powers.

  26. Anna

    So, a term like 1/9 (which is 3 squared) gets its contribution reduced by half, because it's a square of a prime. And numbers like 1/15, which have two distinct prime factors, get kicked out entirely? That's quite an arbitrary-sounding rule for a 'logarithm'!

  27. Michael

    It seems complicated and arbitrary, right? Like you're randomly hacking off parts of the series. But the 'beauty,' as Grant puts it, is that this seemingly random procedure results in the natural logarithm of the original series' sum. It's a profound identity in number theory.

  28. Anna

    That's truly wild! So, this complex transformation turns our series for Pi/4 into the natural logarithm of Pi/4. And what's the significance of this logarithm for our prime number race? How does it explain the bias?

  29. Michael

    The significance is this: after applying the logarithm trick, the new series is predominantly composed of prime numbers and their reciprocals, with some reduced prime powers. Because this new series converges to a constant (ln(Pi/4)), it implies a certain balance between the positive and negative terms.

  30. Anna

    So, if the original series for Pi/4 converges, and the 'logarithm' of it also converges, then the primes within that transformed series must also somehow balance out. But what about the 'bias' for 3 mod 4 primes? Where does that intuition come from?

  31. Michael

    Here's the key: the original series for Pi/4 diverges absolutely. This means if we took all the terms and made them positive, it would blow up to infinity. This tells us that both the 'adding' terms (1 mod 4) and 'subtracting' terms (3 mod 4) would individually blow up to infinity. For the series to converge, they must stay roughly balanced when they're combined with alternating signs.

  32. Anna

    Ah, so the convergence of the alternating series tells us the positive and negative camps can't diverge too quickly relative to each other. And after the logarithm trick, the series is almost entirely primes. So, the balance must happen among the primes!

  33. Michael

    Exactly. Now, for the intuition about the bias: consider the 'buckets' of terms being added and subtracted. The adding bucket contains reciprocals of primes that are 1 mod 4, like 1/5, 1/13. But crucially, it also contains the *squares* of all primes, like 1/2 of 1/9 or 1/2 of 1/25, regardless of whether the original prime was 1 mod 4 or 3 mod 4.

  34. Anna

    Wait, so even if a prime like 3 (which is 3 mod 4) results in a negative term in the original series, its square (9) contributes positively to the adding bucket, albeit reduced by half? That's a significant detail!

  35. Michael

    Precisely. All even powers of primes, like squares, fourth powers, etc., contribute positively to the series after the logarithm transformation. This gives a inherent 'bias' to the adding bucket, the one associated with 1 mod 4 primes.

  36. Anna

    So, if the adding bucket inherently gets this extra weight from all the even powers, but the total sum has to converge to a small constant (ln(Pi/4)), then the 'subtracting' bucket, the 3 mod 4 primes, must have more initial primes to compensate for this positive bias from the powers. Is that the intuition?

  37. Michael

    That's exactly it. To balance out the series and ensure it converges to a constant, the camp of 3 mod 4 primes needs a slight numerical advantage over the 1 mod 4 primes, just to counteract the positive contributions from all those even powers. It's not a formal proof, but it's a very strong intuition.

  38. Anna

    That makes so much sense! It's like the 3 mod 4 primes are working harder to keep the balance. So, this intuition suggests that Team 3 should lead more often in our prime race, which aligns with what we observed empirically.

  39. Michael

    Indeed. The intuition suggests a bias for Team 3 to stay in the lead more often. However, the original conjecture asked if that percentage approached 100% as we look at more and more numbers. And here's where the surprising answer comes in.

  40. Anna

    Okay, the moment of truth! Does the percentage approach 100%? Or does it just stay very, very high?

  41. Michael

    Interestingly, no, it doesn't approach 100%. While Team 3 is in the lead a vast majority of the time, say 99% or 98%, it forever and ever just sort of wanders around. It doesn't converge to a specific percentage like 100%.

  42. Anna

    So, even if you look at the first billion numbers, and Team 3 leads 99.5% of the time, if you then look at the first trillion, it might be 98%? It never completely settles on a percentage, but Team 3 still has a clear advantage?

  43. Michael

    Precisely. They do trade off leads eventually, but there's a clear bias for Team 3. What's more, if you measure the race in a slightly different way, not just counting each prime but discounting them by their reciprocal, the results get even more specific.

  44. Anna

    A different metric? That sounds like a mathematician's way of making a proof work! So, with this modified rule, what's the percentage of time Team 3 leads as you look at larger and larger numbers?

  45. Michael

    With this 'reciprocal discounted' metric, it turns out that Team 3 will be in the lead 99.59% of the time as you look at more and more numbers. So, it's almost always in the lead, but not in the mathematician's sense of 'almost always' (which usually means tending to 100%).

  46. Anna

    So, it's 'almost always' in the way a normal person would use the phrase, but not in the strict mathematical sense. And Team 1, the underdog, will always have its moments in the front, no matter how far along the number line we go?

  47. Michael

    Exactly. Team 1, our 'Little Engine That Could' or 'tortoise,' will always get its turn in the lead. In this metric, it even averages out to be in the lead 0.5% of the time over vast stretches. It's truly a fascinating illustration of how subtle biases can emerge in number theory.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent