# A very unbelievable reality in regards to the quantity 37

*by*Phil Tadros

### 08 Nov 2023

– Tags:

So I used to be on math stackexchange the opposite day, and I noticed a cute post

in search of a ebook which lists, for a lot of many integers, details that Ramanujan

may have advised Hardy if he’d taken a cab apart from 1729. A number of days in the past

OP answered their very own query, saying that the ebook in query was

*Those Fascinating Numbers* by Jean-Marie De Koninck. I made a decision to take

a look by means of it to see what sorts of details lie inside

(and likewise to see *simply* what number of integers are coated!). Not solely was I

overwhelmed by the variety of integers and the variety of details about them,

the *preface* already consists of one of many single wildest details I’ve ever heard,

and I’ve to speak about it right here! Right here’s a direct quote from the preface:

37, the median worth for the second prime issue of an integer;

thus the chance that the second prime issue of an integer

chosen at random is smaller than 37 is roughly $frac{1}{2}$;

My jaw was on the ground once I learn this, haha. First it sounded completely

unbelievable, since 37 is a tiny quantity within the grand scheme of issues. Then

it began to sound barely extra believable… In any case, about half of all

integers have $2$ as their smallest prime issue. It is smart that smaller

primes needs to be extra frequent among the many smallest components of numbers! However then

I assumed “how are you going to presumably *show* this!?”. I’m not a lot of an analytic

quantity theorist^{, however I do know that they’ve good estimates on loads of
details like this. I made a decision it might be enjoyable to attempt to discover and perceive a
proof of this reality, and likewise write some sage code to check it!}

So then let’s go forward and do it ^_^

First, I feel, the sage code. I wish to know if this actually works!

“Obvoiusly” there’s no uniform distribution on the pure numbers, so

what does it even imply to decide on a “random” one? The best way the quantity theorists

often clear up this downside is by fixing a big quantity $N$ and

the chances if you choose a random quantity between $1$ and $N$. Then you definitely

have a look at the $N to infty$ restrict of those chances.

So for us, we’ll wish to first repair a big quantity $N$ after which work with

numbers $leq N$. For $N$ type of small, we are able to simply discover the second prime

issue of every quantity $leq N$ and *examine* the median!

After I first ran this code, it actually felt like magic, haha. What the

*hell* is occurring right here!?

The important thing thought, present in a paper of De Koninck and Tenenbaum^{,
is that we are able to compute the density of numbers whose second prime is $p$
(which the authors denote $lambda_2(p)$) by cleverly utilizing the concepts within the
Sieve of Eratosthenes!}

Let’s do a easy instance to begin. What fraction of numbers have $5$ as

their second prime? Within the language of the paper, what’s $lambda_2(5)$?

Effectively it’s not arduous to see that the numbers whose second prime is $5$ are

these numbers whose prime factorization appears like

or

[2^0 3^a 5^b cdots]so we have to depend the density of numbers of those types.

However a quantity is of the primary kind ($2^a 3^0 5^b cdots$) if and provided that

it has an element of $2$, an element of $5$, and *no* components of $3$.

To carry this again to elementary faculty^{, we are able to spotlight all of
our numbers with an element of $2$}

numbers with no components of $3$

and numbers with an element of $5$

Then the numbers whose prime factorization begins $2^a 3^0 5^b cdots$ are

precisely the numbers highlighted by all three of those colours!

It’s intuitively clear that $frac{1}{2}$ the numbers are blue,

$frac{2}{3}$ are orange, and $frac{1}{5}$ are pink.

So taken collectively,

$frac{1}{2} cdot frac{1}{5} cdot frac{2}{3} = frac{1}{15}$ of numbers

are of this way!

So now we’ve our fingers on the density of numbers of the shape $2^a 3^0 5^b$,

however this is just one of two ways in which $5$ might be the second smallest prime.

The same computation exhibits that

$left ( 1 – frac{1}{2} proper ) cdot frac{1}{3} cdot frac{1}{5} = frac{1}{30}$

of numbers are of the shape $2^0 3^a 5^b$.

It’s simple to see that these units are disjoint, so their densities add, and

$frac{1}{15} + frac{1}{30} = frac{1}{10}$ numbers have $5$ as their

second smallest issue!

Now with the warm-up out of the way in which, let’s see how we are able to compute

$lambda_2(p)$ for our favourite prime $p$!

We’ll play precisely the identical recreation. How can $p$ be the second smallest prime?

Precisely if the prime factorization appears like

for some $q lt p$.

However we are able to depend these densities as earlier than! For every selection of $q$, we all know

that $frac{1}{p}$ numbers are multiples of $p$, $frac{1}{q}$ are

multiples of $q$, and for every $r$ we all know $left (1 – frac{1}{r} proper )$

numbers are *not* multiples of $r$! For every $q$, then, we wish to land

within the intersection of all of those units, then we wish to sum over our

selections of $q$. Taken collectively, we see that

The density of numbers whose second prime is $p$ is

[lambda_2(p) =sum_{q lt p}

frac{1}{p}

frac{1}{q}

prod_{q neq r lt p} left ( 1 – frac{1}{r} right )]

We will rearrange this to

(displaystyle

lambda_2(p) =

frac{1}{p}

left [ prod_{q lt p} left ( 1 – frac{1}{q} right ) right ]
sum_{q lt p} frac{1}{q} left ( 1 – frac{1}{q} proper )^{-1})

As a cute train, write $lambda_k(p)$ for the density of numbers

whose $okay$th prime is $p$.

De Koninck and Tenenbaum point out in passing that

[displaystylelambda_k(p) =

frac{1}{p}

left [ prod_{k lt p} left ( 1 – frac{1}{q} right ) right ] s_{k-1}(p)]

the place

$s_j(p) = sum frac{1}{m}$

is a sum over all $m$ who’ve precisely $j$ prime components, all of that are $lt p$.

Are you able to show that this components is appropriate^{?}

However keep in mind the purpose of all this! We wish to know the prime (p^*) in order that

half of all numbers have their second prime (leq p^*). That’s, in order that

the sum of densities

approx

frac{1}{2}.]

However we are able to implement $lambda_2(-)$ and simply *examine* for which prime this

occurs!

Once more we see that $37$ is the prime the place roughly half of all numbers

have one thing $leq 37$ as their first prime! So we’ve confirmed that

$37$ is the median second prime!

Additionally, this exhibits that we anticipate the precise density to be $approx .5002$.

If we set $N = 10^7$ within the code from the primary half^{
to get a greater approximation, we get $.5002501$, which is remarkably
near the reality!}

As one other cute train – utilizing the concepts on this submit,

are you able to compute the median *third* prime?

As a (a lot) tougher train^{, are you able to get asymptotics for the way
the median $okay$th prime grows as a operate of $okay$?}

Thanks for hanging out, all! This was a extremely enjoyable submit to put in writing up,

and I’m actually excited to share it with everyone!

This reality about $37$ was all I may take into consideration for like per week, haha.

I’ve extra weblog posts coming, after all, so I’ll see you all quickly!

Keep secure, and keep heat ^_^