Primes Sonification

How does prime numbers distribution sounds like?

Ansatz
, in 17 April 2017
primesound

A bit of number theory

Are prime number distributed randomly? Probably not.

One way to see prime numbers is as special cases of some functions. For example, the divisor function $\sigma_0(n)$, is the function that counts how many divisor a number $n$ has. A number is prime if the function equals two (one and itself). The following image contains the first 20000 divisor function values for natural numbers from top to bottom and left to right. The value two (prime numbers) is highlighted.

Although some patter arise, this depends on the number of columns. To avoid a privileged ordering, the Ulam spiral is employed.

$$17\; 16\; 15\; 14\; 13 \\ 18\;\; 5\;\; 4\;\; 3\;\; 12\\ 19\;\; 6\;\; 1\;\; 2\;\; 11\\ 20\;\; 7\;\; 8\;\; 9\;\; 10\\ 21\; 22\; 23\; 24\; 25$$

Let see the divisor function and the prime numbers in this spiral setup. All following spirals go from 1 to 63001.

The Ulam spiral shows something beautiful and complex is going on there. Another related magnitude to describe prime numbers is $\omega(n)$, the number of distinct prime factors of $n$. So for a prime number, the value is 1.

Another pattern arise when plotting $\phi(n)$, Euler's totient function. For given $n$, this function counts the quantity of coprimes with $n$. A prime number has $n$ - 1 comprimes, every number beneath them minus their self. The figure show a normalized $\tilde{\phi}(n)=(\phi(n)+1)/n$, so prime numbers have a value of one.

Lets consider one more function. The one that, for a given $n$, counts the distance to the next prime number, so in a sense it represents the prime numbers gap. This gap value is bounded (next prime bound).

So how it sounds?

As we can see there are several functions that have complex patterns related to the prime number distribution. Another way to get the patter is by hearing the waves generated by these functions values series. As many of this magnitudes diverge with increasing $n$, they are normalized. For example the prime gap distribution $g_n$ is consider to grow asymptotically like $\log p_n$

$g_n = p_{n + 1} - p_n$

$\limsup _{ {n\to \infty } }{\frac {g_{n}}{\log p_{n}}}=\infty$

The following sounds have a sampling rate of 3000 Hz.

Log normalized divisors function
Distinct prime factor $\omega$ function
Normalized Euler Totient function $\phi$
Distance to next prime function
Log normalized prime gap

Surprisingly, all these functions sound somehow similar, between colored noise and a constant inharmonic chord. Even more, if you play the Totient and the Gap together at the same time, the combination sounds like the divisor function. Lets analyze the spectrum of the divisor function sound. The gray line is the auditory excitation pattern and it the components that are masked.

The spectrum shows a fractal structure in the frequency components.

To grasp a little more the notes interval structure, we could reproduce the prominent notes with some instrument and in intensity order (higher to lower). The following are the notes with format (Note, Cents, Octave)

[('D~', (-13c), 6),
 ('B', (+21c), 5),
 ('F#', (+23c), 5),
 ('D~', (-13c), 5),
 ('B', (+21c), 4),
 ('G#~', (+4c), 4),
 ('F#', (+23c), 4),
 ('E', (+19c), 4),
 ('D~', (-13c), 4),
 ('C~', (+22c), 4),
 ('B', (+22c), 3),
 ('A#', (-17c), 3),
 ('F#', (+23c), 3),
 ('E`', (-24c), 3)]