EP 69 · 23:35

A sieve-based intuition for prime density

From How AI Helped Prove the Riemann Hypothesis and What Comes Next

Episode
7/23
Watch How AI Helped Prove the Riemann Hypothesis and What Comes Next
In this chapter

Using the Sieve of Eratosthenes, the hosts build a heuristic argument for why prime density falls off as 1 over log n. They reason that a random number survives being crossed out by each prime p with probability 1 minus 1/p, and multiplying these survival probabilities over all primes up to the square root of n gives a product that matches Euler's product formula for the zeta function at s equals 1, which is just the harmonic series. Since the harmonic series grows like log n, and the density expression is the reciprocal of that Euler product, inverting the product term by term yields a density of 1 over log n, matching what Gauss had only observed empirically.

  1. 01

    The argument explicitly assumes divisibility by different primes is statistically independent, which is not strictly true but is treated as a workable approximation.

  2. 02

    The hosts frame this as a heuristic, 'hacky' derivation rather than a rigorous proof of the Prime Number Theorem.

  3. 03

    Integrating the 1/log n density gives the prime counting function's asymptotic form, x divided by log x, foreshadowing the next discussion of approximation errors.

Transcript

1,647 words · auto-generated from the episode video

23:35So I figured what we really have to do is formalize that intuition by Gauss, right? Gauss showed that the density of primes goes like 1 over log n. And his was kind of an empirical. He was just observing. And he was like, it kind of looks like this, right? We're actually going to prove that that is true right now in this next segment. We're going to prove that the density of primes is given by 1 divided by log n. If you have a number, a random number, that is some yay big, the chance that it is prime is 1 divided by log n. Once you have that, then obviously the logarithmic integral is how you approximate the prime counting function, right? Because it'll just be taking the derivative. So really the thing that we have to establish is the thing that Gauss showed

24:19empirically, but not using a rigorous proof. Makes sense. So we're going to start with the sieve of Eratosthenes again. Let me remind you real quick what it was. What we did was we picked the first number that was open, two, and then we removed all of the other multiples of two. Then we went to the next number that was open, and we removed all of the multiples of that number. In that case, it was three. And then we'd go to five because four had already been removed. And every single one that we visited, every single number that we visited would be the new prime. This, to begin with, is still so crazy to me. Yeah, it's just such a nice way of figuring it out, right? But now we're going to start with this and say, okay, what that means is

25:02that, you know, what's the chance that any random number is going to be taken out by the two run? The run where I'm taking out every multiple of two. Well, that's about a half, right? Because half of the integers are divisible by two and half of the integers aren't. what about what's the probability that any given random number is going to be taken out by the run with three that's a third so there's a two-third chance that I'm going to survive that run right right because a third of the integers are going to be gone if I'm a random integer that's really high up there's a two-third chance that I survive run number three

25:42and then there's a two-third chance there's a four-fifth chance for similar reasons that I survive the run with five I'm I'm kind of I think I'm seeing right where this is going so so it's like yeah um every single prime the run the chance that I survive that is one minus one over the prime right yeah yeah and wait a minute wait a minute wait a second right yeah exactly yeah so here's what we're saying we're saying the density yeah the probability that I survive and all of these runs is one minus one over the primes all multiplied all the way up to the square root

26:26of n because of what I said earlier where the root n is like the halfway mark and this is what we just looked at yeah this is the Siva Veritasanese so the density to be a prime the number n can't be divisible by any of the primes previously and here what we are assuming is that different primes act roughly independently when you get to high enough number the probability that I'm divisible by 2 is independent of the probability that I'm divisible by 3 and 5 that's not true but for this hand wavy argument let's just say it's true It actually works. So in the fashion of Euler, it actually works. So the probability that any given number n survives all of these checks is this

27:11product. It's the product over all primes less than the square root of n of 1 minus 1 over all of those primes. Now, where have I seen that right-hand side? Well, well, well. The Euler product formula comes back, right? it's not the same because on the right hand side in the Euler product formula it's 1 divided by 1 minus 1 over p to the s power but in this case if I make s equal to 1 then it's just 1 over 1 minus 1 over p and on the left hand side which is the density stuff that we were talking about it's just 1 minus 1 over p so the right hand side the Euler product formula is really a product of the reciprocals of the left hand side but there is a

27:55there there There's a there there. Right? You're saying there's a chance. Exactly. So now, we notice that for s equals 1, this is just the harmonic series, which is, you know, the Riemann zeta function. Yep. On the top there, I'm just using the Euler product formula, but this is a finite version of the Euler product formula, where s equals 1, so it's just 1 over k, because usually it's 1 over k to the s, but here if s equals 1, it's just 1 over k. I add those up on the left-hand side. That's my zeta function. And on the right-hand side is the Euler product, right?

28:37Now, the harmonic series, which is 1 plus 1 half plus 1 third plus 1 fourth all the way to 1 over n, that has a very well-known asymptotic relationship, which is just log of n. You can see this by just taking the integral. Integral of 1 over x dx is log x. That's like one of the first things you learn about in calculus. And you can use that to sort of heuristically say, well, the discrete sum also has to be about log of n. Okay. And so now the log of n equals that Euler product, that finite Euler product. All right. We've already got the log in it. Yes. Okay. Yes. Now, final step, we bring it together. and as I said earlier, we noticed that the thing from the Euler product formula,

29:21if I were to say s equals 1, and the density thing that we're after, they're reciprocals of one another, right? And we already established on the top that the Euler product thing is log n. Now because these are products, right, they're giant products, if I want to figure out like a times b times c times d blah blah blah blah blah, and I already know what 1 over A times 1 over B times 1 over C is, because it's a product, I can just flip the whole thing. This isn't a sum where I can't do 1 divided by 1 over... This is a product. And so reciprocating just distributes that action to each one of the terms. And so in the next slide, we actually...

30:02We actually have the expression for density. Boom. The density is 1 over log n. There's a lot of hand-wavy stuff that we did here. We use the fact that these primes are independently sort of picking out numbers. It's not exactly true. But for the sake of our argument, this is not, I'm a physicist, so this is plenty good enough for me. this kind of works right yeah and this is the thing that um that Gauss saw empirically when he was doing stuff by hand he figured out that any number of a certain size the probability that it is prime is one divided by the log of that

30:43number and for the sake of this conversation we're trying to show the relationship between these concepts um and how we are seeing the the foundations of what we're going to build to how they all relate to the same underlying yeah truth exactly the point of this conversation specifically would be that we just used the zeta function to get a bastardized uh we just used the zeta function to get kind of a hacky cheap proof of the prime number theorem. Which is that the density of primes goes like 1 over log n. And so the prime counting function goes like the integral of

31:271 over log n. Or n divided by log n. And we finally have this expression of the prime counting function. We used the zeta function to do this. Gauss did not do this part, by the way. This took later people to actually figure out. the like yeah there's a nice little connection that we can make from if we use Euler's product formula which is over the primes we can actually figure out that the prime counting function which is usually written as pi of x that doesn't mean pi the number multiplied by x it's just a way of writing the function which is count the number of primes before x we just denote it as pi of x and that goes like x divided by ln x the point of this whole exercise was to show you

32:11explicitly that not only are the primes related to the zeta function, that relationship can give you an asymptotic bound on the prime counting function. Yeah. Yeah. Okay? Yeah, and this again, and we talked about this in the last episode, you know, ultimately, we're trying to go from this upper and lower bound to being able to explicitly be on that blue line, which is the prime numbers. Exactly. But we now sort of, we're like narrowing the scope. Exactly, exactly. We have a functional form of that blue and red line, right? Which are very close to the blue line.

32:52The farther I go, sort of the ratio between them gets smaller and smaller.

From the episode
  1. EP 69

    How AI Helped Prove the Riemann Hypothesis and What Comes Next

    The Riemann Hypothesis from first principles: primes, zeta zeros, the Alpöge–Claude proof and what AI means for the future of mathematics.

    How AI Helped Prove the Riemann Hypothesis and What Comes Next

MathematicsNumber TheoryArtificial IntelligenceMathematical ThinkingFormal Verification