
Presumably not original.
What is the probability that a large positive integer N is prime? We can heuristically reason as follows:
It must not be divisible by 2; half of the positive integers satisfy this requirement, so we get a factor of 1/2.
It must not be divisible by 3; two thirds of positive integers satisfy this requirement, even after removing the multiples of 2, so we get a factor of 2/3.
It must not be divisible by 5; four fifths of positive integers satisfy this requirement, even after removing the multiples of 2 and 3, so we get a factor of 4/5.
And so on through the primes until sqrt(N).1
Using a lower-case p to denote primes, an upper-case P for the primality probability, and an equals sign for “should be pretty close to”, we can therefore write
Sums are easier to work with than products, so we take the log of both sides:
Now comes the key step: instead of summing over only the primes, I will sum over all integers n between 2 and sqrt(N), weighting term n by the probability that n is prime. Effectively I’m replacing the “exact” “probability” with an expectation-y probability, and I’ll continue using equals signs because it should still be pretty close.
The point is that we get an equation relating P evaluated at N to P evaluated at smaller numbers, namely
and the goal will be to find a function that satisfies such an equation.
The sum should be well-approximated by an integral, so I will change letters to
Differentiating both sides and applying the fundamental theorem of calculus gives the delay-differential equation
and since x is large, its sqrt(reciprocal) is small, and we can replace the log by its first-order Taylor expansion. This simplifies the equation to
Square roots are difficult to work with, so let x = exp(t), and let F(t) = P(exp(t)). Then
and so
Substituting into (1) and cancelling the x’s gives a delay-differential equation for F,
The derivative at t is related to the function at t and to the function at t/2. If we had the values of the function at a large t and t/2, then we could imagine numerically solving the equation back towards t = 0, but perhaps no further: halving a positive number will never make it negative.
Let us therefore trial a Laurent series expansion for F(t) with a possible pole at t = 0:2
But let us hope that the function does not behave too wildly as we approach the possible pole, and that the Laurent series starts at some finite power k, which will be negative if there is indeed a pole. The left-hand side of (2) will have a lowest power of t equal to k − 1. The right-hand side will have a lowest power equal to 2k. These powers must be equal, so k − 1 = 2k and therefore k = −1:
Inserting this series into (2) gives
We proceed by equating like powers of t. The lowest power we can work with is −2, occurring for n = −1 on the left-hand side and n, m = −1 on the right-hand side. This gives
and therefore
since this coefficient must be nonzero for −1 to be the lowest power of t in the expansion.
The next like power of t to equate is −1, occurring for n = 0 on the LHS of (3) and for (n, m) = (−1, 0) and (0, −1) on the RHS. Since we now know that a_{−1} = 1, we have
and hence a_0 = 0. This is good news, because it sets up a recurrence relation in which all subsequent terms in the series also vanish.
The coefficient of t^r on the RHS of (3) is
We can separate out the terms in the sum involving a_{−1} and reduce the sum to being from 0 to r, so that the coefficient of t^r is
For r = 0, which is the next power we have to equate, the LHS of (3) gives a zero coefficient, and the sum in (4) consists of a single term involving the square of a_0, which is zero. Therefore a_1 = 0, and this process will repeat. The LHS of (3) will give a zero coefficient, the sum in (4) will involve terms a_0 to a_r, which are all zero, thereby showing that a_{r+1} = 0.
The Laurent series for F(t) therefore consists of a single term,
and therefore
or
The probability that a large positive integer N is prime should therefore be pretty close to 1/log(N), 🎉🎉🎉which is the right answer 🎉🎉🎉.
Behind the scenes: error-riddled chats with o3-mini-high.34
The “even after removing multiples of…” bit was not obvious to me, and I asked o3-mini-high for help. Let p_n be the nth prime. We would like to remove multiples of p_1, p_2, …, p_{n−1}, and see what fraction of the numbers remaining are not divisible by p_n.
Let us work modulo M = p_1 * p_2 * … * p_n. The Chinese remainder theorem, applied to this case, says that given an integer x and integers a_1, …, a_n, the system of congruences
has a unique solution modulo M. Now:
there are M combinations of remainders a_i modulo the various p_i.
there are M remainders modulo M.
There is therefore a one-to-one correspondence between the integers mod M and the combinations of remainders mod p_i. So for any combination of a_1, …, a_{n−1} values, there will be p_n numbers left over, and precisely one of those will be divisible by p_n. The numbers not divisible by primes p_1 to p_{n−1} is the set of all numbers left over from combinations in which all of a_1 to a_{n−1} are nonzero. Each one of these combinations leaves a fraction 1 / p_n divisible by p_n, and there are no intersections, so the fraction of numbers left over that are not divisible by p_n is (1 − 1/p_n).
Might there be a shortcut here? I’m not sure if going for the full infinite series is needed.
Hint for introductory puzzle 1: Gamma is the third letter of the Greek alphabet.
Hint for introductory puzzle 2: It’s one of these, but it remains a satisfying exercise to understand it even knowing this context. I was actively looking for a picture like this to introduce the post, and even after a surprisingly helpful Deep Research found a couple for me (I had been flailing around on Google, lost in Greek and Arabic), it took me some time to recognise what was going on.
The 14th-century manuscript is of Nicomachus’s 1st/2nd-century Introduction to Arithmetic (with commentary from the 6th century), and I was originally going to write an extended footnote discussing other manuscripts of this document and the presence or otherwise of the table in the puzzle, which I assume is not present in Nicomachus’s original. For example, the second true positive found by Deep Research, written with different handwriting, contains many of the same errors (though it fills in the gap in B9) – at least one of the scribes was copying numbers without checking them. But, now that I have my bearings in this subject and can approach it semi-systematically, I have enough material to spin it out into an esoteric separate blog post, which should be finished in a week or two.