A ridiculous way to count prime numbers

How many primes are there between 1 and 100? The answer is 25, and to get this answer we just have to count them. But is there a way to come up with a function that counts the number of primes less than or equal to ? In other words, what is the general expression for , where in the first example I would get .

We call this function the prime counting function (PCF) and denote it as . The spoiler is that there actually isn’t yet a sensible closed form expression for the function. However, you can study it asymptotically, and find that in the limit

in the sense that the ratio between the true PCF and it’s approximation tends to one in the limit. This is the prime number theorem, and it reveals one interesting property where the density of primes decreases as we get to larger numbers. But is there really no way to just write some mathematical equation in terms of basic functions that can’t describe the true PCF?

I revisited this during the first course of analytic number theory at Oxford, because James Maynard was teaching it, and I wanted to get a quick impression of what all the fuss was about. It was a suprisingly accessible first course, and I left the class impatiently wanting to play with the ideas myself, instead of doing the sensible thing and revising for my exams.

So here is what I propose as an expression for the PCF in terms of basic functions

We denote this function as for ridiculous, and I argue, that in the limit of some parameters this actually tends to the true PCF

There is something quite wrong about this solution, which is that you take two parameters and to infinity, but they have to remain natural numbers throughout. This is a bit illegal, and looking back, reminds me a little of the malicious tricks that statistical physicists perform to solve many of their own problems, see the replica trick. But if you bare with the idea, then it actually does appear to give you the correct PCF.