The Primenuum

A prime oddity

hex6c
hex6c
Sep 5, 2019 · 7 min read

“The list of prime numbers is the heart rate of mathematics, but it is a pulse stimulated by a powerful caffeine-based cocktail.” Marcus Du Sautoy

An artistic visualization of all primes contained in the first million of natural numbers (high resolution version). We call such a visualization a Primenuum. The Primenuum artworks are tokenized as digital art on SuperRare gallery

A prime number (or prime) is a natural number greater than 1 that cannot be formed by multiplying two smaller natural numbers. Equivalently, primes are the numbers with no divisors besides 1 and the number itself. For instance, 17 is prime, but 21 is not prime, since 21 = 3 · 7, hence 3 and 7 are divisors of 21.

Primes are central in number theory because of the fundamental theorem of arithmetic: every natural number greater than 1 is either a prime itself or can be factorized as a product of primes that is unique up to their order. For instance, 108 = 2 · 2 · 3 · 3 · 3 = 2² · 3³.

Primes are also used in several routines in information technology, such as public-key cryptography, which relies on the difficulty of factoring large numbers into their prime factors.

There are infinitely many primes, as demonstrated by Euclid around 300 BC. However, no known simple formula separates prime numbers from composite (non-prime) numbers. Nevertheless, the distribution of primes within the natural numbers in the large can be statistically modelled. The first result in that direction is the prime number theorem, proven at the end of the 19th century, which says that the probability of a randomly chosen number being prime is inversely proportional to its number of digits, that is, to its logarithm. Hence, although there are infinite many prime numbers, the frequency of primes within the natural numbers slowly declines as the number of considered natural numbers increases.

These are a number of open questions related to primes, often having an elementary formulation. Some of them are listed below:

  • Goldbach’s conjecture: Every even integer greater than 2 can be expressed as the sum of two primes.
  • Twin prime conjecture: There are infinitely many twin primes, that is prime pairs that differ by 2.
  • Polignac’s conjecture: For every positive integer k, there are infinitely many pairs of consecutive primes that differ by 2k (this is a generalization of the twin prime conjecture to all even numbers).

There exists a general consensus in aesthetics that beauty lies at intersection of order and disorder. The perfect order is tedious and therefore not attractive. The chaos is incomprehensible to our brain and therefore is equally unappetizing. When we depart from order without resulting in complete chaos, maintaining an unstable balance between regularity and mess, often we get a result that surprises and thrills, so that we may define it beautiful.

“Delight lies somewhere between boredom and confusion. If monotony makes it difficult to attend, a surfeit of novelty will overload the system and cause us to give up; we are not tempted to analyze the crazy pavement.” Richard Padovan

In my view, prime numbers are the perfect incarnation of this idea of aesthetic and hence are a luscious ingredient of beauty and art. Prime numbers are infinite in number and as they grow they become rarer and rarer. However, mathematicians conjecture there are infinitely many close pairs of primes (like twin primes, that distance 2, or cousin primes, that distance 4). The exact distribution of primes within the natural numbers is still a mystery and is related to one of the most famous unsolved questions in mathematics, dating from 1859: the Riemann hypothesis, one of the Millennium Price Problems.

We propose an artistic visualization of primes, called Primenuum. The idea behind it is quite simple and came to the beautiful mind of artist Sergio Scalet from Hackatao while thinking at the branching process of natural trees. The idea was then coded in Processing by Massimo Franceschet from HEX0x6C.

Scan the natural numbers starting from 1. For every number, draw a small segment of fixed size, starting from the center of the canvas and moving from left to right. When a prime number is encountered, turn the drawing direction 90 degrees clockwise (alternatively, turn the canvas 90 degrees counter-clockwise).

An animation showing the construction of a small Primenuum of size 200.

The size of a Primenuum is the number of natural numbers it contains. In the following we show the (low-resolution) black and white Primenuum of size 1000, 2000, 5000, 10000, 20000, 50000, 100000, 200000, and 500000. The green circle is the starting point and the red circle is the ending point. We suggest to download and get lost in the high-resolution versions(5.1 M).

A segment in a Primenuum corresponds to a prime gap on natural numbers, that is a sequence of consecutive composite (non-prime) numbers. This is necessarily of even size (2 for twin primes). On the other hand, each turn in a Primenuum matches a prime number. Twin primes correspond to U turns, that is sharp rotations of 180 degrees. Since the probability for a number of being a prime declines as the number increases, we expect fewer rotations and longer segments, on average, as the Primenuum grows in space. However, if Polignac’s conjecture holds true, then, for every even number, there are infinitely many segments of that length.

For example, in the Primenuum with 1000, 10000, 100000, and 1000000 natural numbers, there are, respectively, 168, 1229, 9592, and 78498 prime numbers (turns), for a decreasing relative frequency of 0.168, 0.123, 0.096, and 0.078. The increasing average prime gap (length of a segment) is, respectively, 5.93, 8.11, 10.42, and 12.74, with an increasing maximum gap of 20, 36, 72, and 114.

Next we show the colored Primenuum of size 1, 2, 3, 4, and 5 millions. Colors start at grey and slightly change when a new prime is found. Notice that each image is included in the next (larger) one. You can download the high resolution versions in black and white (87.8 M) and color (105.4 M).

Questions in the terse realm of primes might be mapped into the visual Primenuum universe and maybe this can suggest a new way for finding a solution. On the other hand, the Primenuum structure can hint original queries related to prime numbers. Some are listed below:

  1. Are there recurring patterns in the Primenuum?
  2. Does the Primenuum has a fractal structure? More generally, is there any symmetry in the Primenuum structure?
  3. Since there are prime gaps of arbitrary size, the Primenuum is not bound in space. However, does it expand without limits in all four directions?
  4. We say that two primes are overlapping if they lie on the same bidimensional point in the Primenuum canvas (this induces an equivalence relation among primes). Are some points of the canvas attracting primes, meaning that there are many overlapping primes over that point? Are other points repelling primes?

“Every fool can ask questions about prime numbers that the wisest man cannot answer” G. H. Hardy

The described Primenuum is a bidimensional object but it can be generalized to an n-dimensional Primenuum for every integer n larger than or equal to 1. We are planning to build a 3 dimensional Primenuum (3D printing and handmade).

I fancy a race to draw (or build) larger and larger (2D and 3D) Primenuum, similar to the run to discover bigger and bigger primes (my laptop stops at 5 million numbers, essentially because of a memory overflow due to the growing canvas). If you manage to compute large Primenuum, please send us the low and high resolution images so we can add them, as well as your name, to this page. Also, if you came up with additional interesting questions on the Primenuum, I would love to add them to the above list (with your name).


Short after the publication of this post LuGher managed to compute much larger Primenuum using a collage technique, that is, by computing different pieces of the Primenuum and glueing them together. Here is the impressive animated sequence from 100 millions to 2000 millions (2 billions) with increments of 100 millions numbers:

The Primenuum from 100 millions to 2 billions (steps of 100 millions numbers)

hex6c

Written by

hex6c

data scientist / generative artist / blockchain enthusiast / crypto art evangelist / hex6c.art

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade