How many primes are there below x? This is called π(x), and it's a most fascinat...

@johncarlosbaez@mathstodon.xyz

How many primes are there below x? This is called π(x), and it's a most fascinating function. How can we approximate it?

Gauss noticed that the probability that a number n is prime looks close to 1/ln(n). If so, π(x) should be close to the integral of 1/ln(n) from 0 to x. This integral is called li(x).

If you compare li(x) to π(x) you'll see it starts out bigger. Indeed it's known to be bigger for all x up to 10¹⁹. But in 2000, two mathematicians named Bays and Hudson showed that π(x) catches up with li(x) and exceeds it for x near 1.39 ×10³¹⁶.

That's a huge number! We can't precisely count all the primes up to this point - listing them would overfill the observable universe. So I became interested in how Bays and Hudson showed π(x) gets bigger than li(x) at this point, and I read their paper. It was fascinating.

Their paper has some graphs of

(π(x) - li(x)) ⋅ ln(x)/√x

but they look very ugly, so I decided to see if I could make better ones. Here's one!

The blue curve is the best estimate we can get using a table of the first 2,001,052 nontrivial zeros of the Riemann zeta function - it turns out they're important here. The red curve is basically a smoothed version of the blue curve.

The blue curve is not completely trustworthy, but if the red curve goes above zero for long enough, we can be sure that π(x) exceeds li(x) somewhere in that region. Using this, Bays and Hudson showed there are at least 10¹⁵³ integers n with π(n) > li(n) near 1.39822 × 10³¹⁶ .

It's so cool to be able to probe what's going on for such large numbers!

(1/2)