# MP3 of the Riemann Zeta Function on the Critical Line

The Riemann zeta function, for values of its argument located on the critical line (z = 1/2 + i t for real t), looks so much like a sound wave that I decided I ought to listen to it:

listen to the Riemann zeta function.

Here is the C++ program I use to compute (approximate) values of the function for positive arguments (the negative side is the same: zeta(a+bi) = zeta(a-bi)) and write them to an existing WAV file. I use an existing file to avoid having to know the WAV header format. The value of the Z function is a complex number and the WAV file is stereo audio; so it writes the imaginary component to the left channel and the real component to the right.

The actual computation of the zeta function isn't accurate enough to locate zero-crossings, but is adequate for creating a sound wave. (The error is in higher-frequency components, and as discussed below I find it useful to drop these.)

The program computes a series sum based on the following rather fundamental formula for the Zeta function:

zeta(z) = 1/(1-2^{1-z}) SIGMA_{[n=1..inf]} -1^{n-1} n^{-z}

I split the odd and even terms to get:

zeta(z) = 1/(1-2^{1-z})
( SIGMA_{[odd n>0]} n^{-z} - SIGMA_{[even n>0]} n^{-z} )

and combine pairs of terms to get:

zeta(z) = 1/(1-2^(1-z)) SIGMA_{[n=1..inf]} ( (2n - 1)^{-z} - (2n)^{-z} )

The primary component of the sound (the loudest tone you hear) is the term

2 cos(theta(t))

in the first term of the infinite series for the Riemann-Siegel Z function. It rises in pitch at the rate

freq ≈ K ln(t)

(which is related to the known result concerning the average spacing of the complex zeros). You can hear this tone "drop out" after about 15 seconds because the Zeta function was computed using 1000 terms of the above series for zeta(z), and the higher-frequency components are the ones that take longest to converge. The next-loudest component drops out some time later. I actually kind of like this because if the loud components did not drop out, it would be hard to hear the patterns in the other components (which is where most of the structure is).

## Riemann-Siegel Formulas

The Riemann-Siegel Z and theta functions define zeta(z) in terms of its argument (theta) and absolute value (Z) for a value of z equal to 1/2 + i t, by the relation:

Z(t) = zeta(1/2 + i t) e^{i theta(t)}

For real t, Z(t) and theta(t) are both real, and we have:

theta(t) = (0 or pi) - arg (zeta(1/2 + i t))

magnitude( Z(t) ) = magnitude( zeta(1/2 + i t) )

Z and theta are defined in terms of each other, the Gamma function, power series coefficients, and a few other things.

Z(t) and theta(t) should be a really good way to calculate the Zeta function on the critical line. However, I have not been able to find sufficiently accurate descriptions of Z() and theta() to actually use in a computer program. (If anyone knows of one, please email me!)

If you like this sort of thing, you might also be interested in these other pages having to do with maths:

My numbers and large numbers pages, the RIES program (which finds algebraic equations given their solution); Hypercalc (the calculator that doesn't overflow); and my table of Classical Sequences.

This page was written in the "embarrassingly readable" markup language RHTF, and was last updated on 2020 Mar 26. s.11