An Alternative Illustration of Prime Number Distribution

Prime number theorem dictates the asymptotic behavior of prime number distributions. In layman terms, the distance between prime numbers increases at a logarithmic pace. This gives the familiar logarithm figure.

Alternatively, if we “bin” the prime numbers according to the differences (gaps) between two consecutive prime numbers, we would yield another logarithmic distribution: the histogram of such differences will be logarithmic as well.

So, take the following sequence of prime numbers for example:

2, 3, 5, 7, 11, 13, 17, 19, 23, 29…

The distances between the consecutive numbers in the above sequence are:

3-2 = 1
5-3 = 2
7-5 = 2
11-7 = 4
19-17 = 2
23-19 = 4
29-23 = 6

We then calculate the histogram based on the gaps.

Denote the histogram bin index as
\[i = \lfloor\frac{d}{2}\rfloor\]

For the example above, we get the following distributions for H[i]:
\[H[0] = 1, H[1] = 3 H[2]=2, H[3]=1\]

Now we calculate the distribution (H[i]) described above using prime numbers within the following interval (for all prime numbers up to 4,294,967,291):
\[[2^0, 2^{32}]\]

We can obtain the following plot for the histogram (H[i]):

Prime number distribution

Prime number distribution

To illustrate that the distribution is indeed around a logarithm curve, we take the logrithms of the values for each H[i] and get the following figure:

Prime number distribution

Prime number distribution

As you can see, the distribution is around a straight line.

Be Sociable, Share!


  1. John Graffio says:

    I wonder if anybody out there is working on discovering a mathematical space where prime number distribution appears linear, i.e., non-logarithmic in this case. I say this because some savants who can calculate astronomically large numbers in their heads say they can “see” the numbers in a row. So I wonder if the brains of these individuals are able to do this mapping by some unknown mechanism.

    • Nate Strech says:


      Good question!

      I just read the autobiography of the savant Daniel Tammet in which he describes a charity event where he verbally recalls the first 22,514 digits of the number pi from memory. It seemed far more likely that his brain was “seeing” the row you speak of rather than performing some astronomical subconscious calculation.

      I suppose it also seems more likely that his photographic memory stored that much info along with the “number landscape” he describes visualizing. I really wonder how many random letters (A-J) he could recall in sequence if provided time to memorize.


      Thanks for sharing – this illustrates how we inferior brained humans almost “see” that darn row.

Leave a Reply