Hey everyone, this is the third in a trilogy of videos with Grant Sanderson from 3Blue1Brown about sequences that don’t necessarily do what you’d expect. Links to the first two videos are on the screen and in the video description; you don’t have to have watched them to understand this one, but you may want to watch them to get the full experience.

The way this is gonna work, we’re gonna have a race between prime numbers. We’re going to have two different categories: those which are 1 mod 4, meaning when you divide by 4 they leave a remainder of 1, and those which are 3 mod 4. We’re basically just going to count up the prime numbers.

So the first one is 2, and 2 is disqualified from the race because it’s the oddest prime, it doesn’t really fit into the pattern of the rest, it’s the only one that’s even. Next we’ve got 3 and then the next one is 5 and then the next prime is 7. 7 is 3 above a multiple of 4; and then 11 is also 3 above a multiple of 4. And then the next one 13 is just 1 above a multiple of 4, and then the next one, 17.

So they seem pretty neck and neck so far as we’re kind of counting up. So after 17 we’ve got 19, which is 3 above a multiple of 4, and then 23 which is 3 above a multiple of 4. And then the next one will be 29, and then after that we’re going to have 31, 37.

And one thing you might notice is that so far in the whole race, even though it’s pretty neck and neck, team 3 has always been in the lead so far. And you might say, okay, that seems maybe just kind of at random that that would be the case; but actually if we continue this race - and if you want I can give you some visuals that like show the race continuing on - it will be- it’ll always be 3 who seems to be in the lead. And you know they’re pretty close, they’re a pretty even balanced like you might expect; but if it was completely random, if it was just random which bucket you’re tossing it into you wouldn’t expect such a long streak for there to be a particular winner.

And in fact it continues going on until the first time that team 1 mod 4 is gonna break into the lead is going to happen at the prime 26,861. But even then the next prime after that is going to be 26,863. So that was just one brief moment of peeking into the lead and then after that they do stay in the lead quite a bit longer, team 3 mod 4. And then the next time that team 1 is able to get ahead is going to happen at 616,841. And it keeps the lead a little bit longer then but then 3 takes over.

If we look at most of the numbers, most of the time it seems like - you know 99% of the time - the team that’s in the lead is team 3. This was actually a conjecture that someone made that said: is it the case that as we let n tend to infinity and we consider at all of the points of the race, how often was it the case that team 3 was in the lead? Does that percentage of the time approach a 100%?

Interesting question. You might expect it to be true, if there’s any reason that there should be more 3s then you might expect it to either fall, you know, completely 50/50 or completely to 100%. But, you know, I think the question I’d like to talk about a little is why would you expect something like this to happen? It feels like the prime shouldn’t have a bias one way or another, um why does this team get any kind of advantage? - (Well primes do have a bias, they have a bias towards odd numbers)

Fair point, okay, so there’s a very strong bias towards odd numbers; um and maybe you’re on to something there that we shouldn’t treat primes so randomly. But often you have this criteria that’s once you rule out the obvious things that primes aren’t going to do, the things based on divisibility constraints, their behavior feels random. And this series has it.The criteria is,   it has to be alternating and it has to converge. And so if you want to take a logarithm of this  series, so you can see what it’s doing in the  long run, you can take the logarithm of both  sides, and the logarithm of this series is going  to be equal to the sum of the logarithms of the  individual terms.

The story starts with a formula for pi, which is a series of alternating numbers: 1 over 1 minus 1 over 3 plus 1 over 5 minus 1 over 7.... This series is given the name chi of n, where chi of n is +1 if n is 1 mod 4, -1 when n is 3 mod 4, and 0 when n is even. The series converges to pi-fourths, which is not important for the story.

The magical fact is that number theorists have a favorite way to take a logarithm of this series, which works if the series is alternating and converges. Taking the logarithm of both sides, the logarithm of the series is equal to the sum of the logarithms of the individual terms. But it’ll be the  natural logarithm of this sequence, which is a   very famous sequence called the Basel problem.

There’s got to be a number associated with every natural number, so we might think of 0s for all of the evens here, and then it has to have the property that when I multiply the terms associated with two numbers like 3 and 5, the product of the terms corresponds to the product of those numbers. So, in this case, 3 times 5 is 15 and negative 1/3 times positive 1/5 is indeed negative 1/15. It’s not exactly obvious, but this will hold no matter which ones you look at. For example, if we take 1/7 and 1/3: negative 1/7 times negative 1/3 will be positive 1/21. And if we go on, it would be a positive 1/21. So, as long as that property holds, you can do this magical thing to take a logarithm, where I’m going to say, I don’t like composite numbers, I’m going to kick out my composite numbers. If you’re not prime either you’re not going to be in the club or you’re going to get a strong punishment based on how not prime you are. So, 1 we don’t like you, 1 gets kicked out entirely. 1/3 you get to stay, 1/5 you get to stay, 1/7 you get to stay. 1/9 we say okay, 1/9 you’re not prime, I don’t like you, but you’re just a prime power. At least you only have one prime factor, so you’re not as bad as those dirty composites like 6 or 15. So, we’ll let you stay, but because you’re the square of a prime we’re going to give you a punishment by reducing you by 1/2. So it gets to stay but only half as powerful. And then it goes on: 1/11, you’re prime, you’re cool, you get to stay. 1/13, you’re prime, you’re cool, you get to stay. 1/15, not only are you not prime, you have two different prime factors, you’re very composite, you’re out of the club entirely. And I’ll just do a couple more to kind of make it clear: we’ve got 1/17 - and notice I’ve got two pluses in a row but that’s because we kind of kicked out the minus. All we care about is whether this number is 1 mod 4 or 3 mod 4. So, I’ll be subtracting off 1/19, I will also be subtracting off 1/23, because uh 1/21 got kicked out for having too many factors. 1/25 we’re going to have to keep him but divide him by 2. A way of saying, okay you’re not prime, but you’re just a prime power, and because you’re the square of a prime you get reduced. And just to make this extra clear, the next one that we see is the cube of a prime, 1/27, so I’m going to reduce it by 1/3 that gets me 1/27. In general what we’re doing here is we’re taking 1 over k times something divided by p to the power of k, where p is a prime number, k could be anything, and we’re basically taking this chi function of p to the k. Which is just a way of measuring, are you 1 mod 4 or 3 mod 4? So that might be how you write this in general. So it’s it’s not a shortcut, it’s just the coolest way - because if you - okay I do this, I do this completely random procedure to my series, and you’d say what is it going to equal? I don’t know, some completely different number that’s completely unrelated to the thing that we started with. Because you went, primes are such a random thing that you’re hacking them off at these seemingly random points, you should expect nothing normal to come from this. But the beauty is that what you get is just the natural log of whatever it was before. And we could do this with a lot of different things actually: another famous sequence people might know is if we take 1 over 1 + 1 over 4 + 1 over over 9 and we add up the reciprocals of all the square numbers. So we kind of go on and we’re always adding up 1 over n squared. This has the property we care about, where when you multiply corresponding terms, what you get corresponds to their product. If we do the same game, we kick out some prime numbers, we keep the prime powers but we reduce them a little bit, it’ll again be a logarithm. But it’ll be the natural logarithm of this sequence, which is a very famous sequence called the The key equation at this point is to focus on what happens after we do our log trick where all the stuff that remains in the series is mostly primes. So, what we can say is that if we ignore all the prime powers, those converge absolutely and have to be bounded by some constant. This tells us two important things: one is why we have a kind of even balance in our race, and the other is that neither one of the camps of adding or subtracting primes blows up much faster than the other. However, all of the nuance for who’s winning the race happens when we really think hard about what happens to those prime powers. Here’s the intuition - it is not a proof - but here’s the vague intuition for why you might expect 3 mod 4 to be winning this race even if you didn’t start performing the race. In this camp of things that we’re adding, we have the reciprocals of primes which are 1 above a multiple of 4, the squares of primes, as well as things like one half of 1 over 9, 1 over 25 and 1 over 49. It still kind of toggles   around and it never really approaches anything.

You might expect that when looking at a large number of numbers, such as the first billion or trillion, team 3 would be in the lead a vast majority of the time. However, this is not the case. Even when looking at the first quadrillion numbers, the proportion of numbers where team 3 is in the lead still toggles around and does not approach any particular value. This suggests that in order for the equation to balance out and for the natural log of pi/4 to be a constant, there needs to be a bias for 3-team 3 to stay in the lead more, with a few more primes that are mod 3 to make up for the imbalance that they get when introducing the powers. to join them, please take a look at the link in  the description.

As you look at it then, you know, maybe it’s like 98% of the time that team 3 is in the lead. So they do trade off but there’s a clear bias for team 3, and the question is, you know, how often do they trade off? And uh turns out if you measure in a slightly different way - so we’re going to change the rules of the race, where rather than counting each prime um exactly you kind of discount them by the reciprocal of that prime - it turns out the team 3 will tend to be in the lead, as you look at more and more numbers it’s in the lead 99.59% of the time. So as you look at bigger and bigger numbers it tends to be the case, with the appropriate metric, that this is the amount of time the team 3 is in the lead. So it’s it’s almost always in the lead but not almost always in the usual mathematician sense of the phrase. Because usually when they say ‘almost always’ they mean like 100% uh or it tends to 100%. So instead it’s in the normal human way of using the word almost, almost always uh the case that uh team 3 is in the lead. But it is not such a clean fact that it’s just 100% or 0. No matter where you are in the number line team 1 has always got another moment in the front coming. It’s the Little Engine That Could - yes yes it really is, it really is. It is the tortoise, slow and steady um every now and then it beats the hare - even if the hare seems systematically better.

Thanks for watching this video. If you want to see more from Grant you probably already watch his channel 3Blue1Brown, there’ll be links in all the usual places. I’d also like to say thank you to Numberphile’s Patreon supporters who make it possible for me to travel and have the time to meet with people like Grant and make these videos. If you’d like to join them, please take a look at the link in the description.