What does a 150-year-old unsolved problem in mathematics have to do with how to tune musical instruments?

Most people who’ve heard of the Riemann zeta function know it in one of two contexts: either as the star of one of the greatest unsolved problems in mathematics (the Riemann Hypothesis, with its $1 million Millennium Prize), or as a piece of arcane machinery from analytic number theory that somehow relates to the distribution of the prime numbers. What almost nobody expects is for it to show up in a conversation about guitar tuning, microtonal music, or whether dividing the octave into 53 equal steps is a good idea.
And yet, here we are.
The Riemann zeta function turns out to be a surprisingly natural tool for answering a very practical musical question: given that you want to divide the octave into N equal steps, how well does that tuning system approximate the pure, mathematically ideal ratios of just intonation? The zeta function doesn’t just answer this question — it answers it for all possible values of N simultaneously, continuously, and with mathematical elegance that feels almost unfair.
This post is an attempt to explain how that works, why it matters for music, and what the resulting lists of “good” tuning systems look like.
A Quick Primer: What Is Just Intonation?
Before we get to the mathematics, a little musical context helps.
When two notes sound together, their pleasantness (or lack thereof) is largely determined by the ratio of their frequencies. Two notes an octave apart have a frequency ratio of exactly 2:1. A perfect fifth — the interval between, say, C and G — has a ratio of 3:2. A perfect fourth is 4:3. A major third is 5:4. These are the ideals of just intonation (JI): a tuning system where every interval is expressed as a ratio of small whole numbers.
The problem is that just intonation is mathematically incompatible with itself in practical use. If you tune a circle of twelve perfect fifths (3:2 each), you don’t end up back at the same note you started on — you overshoot by a small amount called the Pythagorean comma. This is why practical Western music uses equal temperament: divide the octave into 12 equal steps, each a ratio of 2^(1/12), and accept that none of your intervals (except the octave itself) are exactly pure. The fifth is slightly flat, the third is a bit worse, but everything is at least consistent and you can play in any key.
The question microtonal musicians ask is: what if 12 equal steps isn’t the right number? What if 19 steps, or 31, or 53 gives you a better deal — more intervals closer to just intonation, even if you have more notes to work with?
Equal Divisions of the Octave (EDOs) and the Problem of Rating Them
A tuning system that divides the octave into N equal steps is called N-EDO (or N-equal division of the octave). 12-EDO is standard Western tuning. 19-EDO was explored by Renaissance theorists and has a beautifully pure minor third. 31-EDOapproximates the ratios of the 5-limit (ratios involving the primes 2, 3, and 5) with impressive accuracy. 53-EDO is so accurate for 5-limit JI that Helmholtz called it “perfect.”
But how do you systematically compare all these systems? You could check each prime ratio individually — how close is the best approximation of 3/2 in 12-EDO versus 19-EDO, and so on — but that only works for a fixed set of primes, and choosing which primes to care about is itself a subjective decision. What you’d really want is a single function that captures, in some holistic sense, how well a given EDO approximates “all of just intonation.”
This is precisely what the Riemann zeta function provides.
Gene Ward Smith’s Insight
The key insight came from mathematician and microtonal theorist Gene Ward Smith. Here’s the rough version of his argument.
For a given EDO size x (which can be a non-integer, representing a slightly stretched or compressed octave), you can ask: how wrong is the best approximation of each prime number? For prime p, the equal division x approximates it with an error proportional to how far x · log₂(p) is from the nearest integer. Call this the “relative error” on prime p.
Smith then considered weighting these errors by 1/log₂(p) — a natural choice, since it reflects how “complex” a prime is in the harmonic series — and summing them up over all primes. This is essentially the spirit of Tenney–Euclidean (TE) error, a standard tool in regular temperament theory. But here’s where things get interesting: if you want the sum to converge (since there are infinitely many primes), you need a convergence factor. If you replace the weighting 1/log₂(p) with 1/p^sfor some s > 1, the sum suddenly looks like something very familiar.
It starts to look like the logarithm of the Riemann zeta function.
After a few algebraic steps — substituting cosines for squared errors (a smooth approximation that preserves all the relevant structure), including prime powers as well as primes (using the von Mangoldt function), and cleaning everything up — you find that the function you’ve constructed is exactly the real part of log ζ(s + 2πix/ln 2). Exponentiating both sides, the absolute value of the Riemann zeta function literally measures the approximation quality of the equal division x.
Higher |ζ| means the EDO is better at approximating just intonation. Peaks in the function correspond to especially good tuning systems. Zeros of the zeta function correspond to EDO sizes that are especially bad — tunings that fail to represent JI at all.
What the Zeta Function Is Actually Measuring
Researcher Mike Battaglia extended Smith’s work to give a deeper interpretation of what the zeta function measures.
When you expand |ζ(s)|² as a double sum and carefully rearrange the terms, you find that it equals a sum of cosine functions, one for each pair of positive integers (n, d). The cosine corresponding to the pair (n, d) peaks whenever the EDO size x is exactly an equal division of the rational interval n/d. In other words:
- The cosine for (2, 1) peaks at 1-EDO, 2-EDO, 3-EDO, … (every EDO perfectly represents the octave)
- The cosine for (3, 2) peaks at EDOs that perfectly represent the perfect fifth: 2-EDO, 5-EDO, 7-EDO, 12-EDO, …
- The cosine for (5, 4) peaks at EDOs that perfectly represent the major third: 5-EDO, 9-EDO, 14-EDO, …
The zeta function is the sum of all these cosines simultaneously, weighted by how harmonically complex each interval is (via the factor 1/(nd)^σ). A good EDO is one where many of these cosines peak at roughly the same place — where the approximation of many different intervals all lines up well.
This is an elegant confirmation that the zeta function really is doing what we hoped: it’s measuring how well an EDO approximates all rational intervals at once, with more weight given to simpler intervals.
Battaglia also showed that this measurement works whether you’re summing over just the prime powers (as Smith originally showed), over all unreduced rationals, or over all reduced rationals — these three viewpoints turn out to be equivalent up to a constant factor. They all rank EDOs identically.
There’s also a connection to harmonic entropy, a psychoacoustic model of consonance developed by Paul Erlich. The zeta-related expression turns out to be the Fourier transform of the harmonic Shannon entropy for infinitely many harmonics — connecting the abstract mathematical rating system to a model of how the human ear actually perceives intervals.
The Critical Line and Why σ = 1/2 Matters
The Riemann zeta function is defined for complex arguments s = σ + it. The parameter σ (the real part) acts as a rolloff factor: it determines how quickly complex intervals become irrelevant to the score. Large σ means only very simple intervals matter; small σ means increasingly complex intervals are included with meaningful weight.
For σ > 1, the Dirichlet series defining ζ(s) converges and everything is well-behaved. But the interesting region for tuning theory is the critical strip, where 0 < σ < 1.
As σ decreases toward 1/2 (the critical line), the “information content” of the zeta function about higher primes increases. More and more of the complexity of the harmonic series is captured. At σ = 1/2, you get the richest picture of prime approximation. Beyond σ = 1/2 (toward σ = 0), the functional equation of the zeta function means the information content starts to decrease again symmetrically.
This is why tuning theorists focus on the critical line σ = 1/2. The values of the zeta function there — specifically, the real function Z(t) called the Riemann-Siegel Z function, which is defined so that |Z(t)| = |ζ(1/2 + it)| — give the most comprehensive picture of EDO quality across all prime limits simultaneously.
The peaks of |Z(t)| correspond to the best EDOs. Its zeros correspond to the worst. And this is where the connection to the Riemann Hypothesis becomes more than a curiosity: all known zeros of the zeta function lie on the critical line, and the Riemann Hypothesis asserts they all do. The visualizations used in tuning theory that seem to show “zeros off the critical line” for large EDOs turn out to be artifacts of numerical approximation — not actual counterexamples.
The Gram Points Connection
There’s a beautiful geometric way to understand why integers (i.e., pure-octave EDOs) tend to be especially good candidates.
For large σ, the zeta function is dominated by its first term and is approximately real when x is an integer. As σ decreases toward 1/2, you can trace the path along which ζ(s) remains real — and this path intersects the critical line at special points called Gram points, named after the 19th-century Danish mathematician Jørgen Pedersen Gram.
The Gram points corresponding to integer values of x (i.e., pure-octave EDOs) arrive at the critical line having traveled from large σ, during which time the zeta function was increasing. This means the value of ζ at a Gram point corresponding to a good EDO is expected to be large — it has had time to accumulate contributions from many small primes all pointing in the same direction. The Riemann-Siegel formula (a deep result connecting ζ at Gram points to the behavior of prime numbers) confirms this: when x corresponds to a harmonically rich EDO, the value at its Gram point is especially large.
This is what it looks like in practice: a graph of |Z(t)| around t corresponding to 12-EDO shows a peak that is both taller and wider than its neighbors at 11 and 13 — the mathematical signature of a particularly good tuning system.
The Lists: Which EDOs Are Actually Good?
The practical output of all this theory is a set of ranked lists of EDOs. Here are the main ones:
Zeta Peak EDOs (with tempered octaves)
These are the EDOs — or more precisely, slightly-stretched/compressed versions of them — that set successive records for zeta function height:
1, 2, 3, 4, 5, 7, 10, 12, 19, 22, 27, 31, 41, 53, 72, 99, 118, 130, 152, 171, 217, 224, 270, 342, 422, 441, 494, 742, 764, 935, 954, …
Many of these will be familiar to microtonalists. 12-EDO is the standard Western scale. 19-EDO is beloved for its pure minor thirds and expressive leading tones. 31-EDO was championed by Christiaan Huygens in the 17th century and Zhea Erose and Levi McClain in the 21st. 53-EDO is a favorite of theorists for its extraordinary 13-limit accuracy. 72-EDO is used by some contemporary composers for its ability to notate a wide range of just intervals.
Zeta Peak Integer EDOs (pure octaves only)
If we require the octave to be exactly 1200 cents — no stretching allowed — the list changes slightly:
1, 2, 3, 5, 7, 10, 12, 19, 22, 31, 41, 53, 87, 118, 130, 171, 224, 270, 311, 472, 494, …
The most notable absence is 72-EDO: the zeta function prefers a slightly compressed version of 72, so the pure-octave version doesn’t set a record (53-EDO is still better). The appearance of 87-EDO and 311-EDO here but not in the tempered list is also interesting — these are systems whose octave is best left pure.
Zeta Integral EDOs
Instead of looking at peak height, look at the area under the Z-function curve between successive zeros. This gives more weight to systems that are broadly good rather than sharply peaked:
2, 5, 7, 12, 19, 31, 41, 53, 72, 130, 171, 224, 270, 764, 954, 1178, …
These tend to be considered the “best of the best” — systems where the zeta function is large over a wide range, not just at a single point.
Zeta Gap EDOs
These are defined by the size of the gap between surrounding zeros of Z (normalized for the fact that zeros become denser at larger values). They tend to emphasize higher prime limits more:
2, 3, 5, 7, 12, 19, 31, 46, 53, 72, 270, 311, 954, 1178, …
Strict Zeta EDOs
The strictest criterion: appear on all four of the above lists.
2, 5, 7, 12, 19, 31, 53, 270, 1395, 1578, 8539, 14348, 58973, …
These are the EDOs that are unambiguously excellent across every metric the zeta function offers.
Zeta Valley EDOs: The Other End of the Spectrum
Just as the peaks of the zeta function identify the best EDOs, its local minima identify the worst — tuning systems that are unusually bad at approximating just intonation. These are called zeta valley EDOs:
These can actually be musically interesting for the opposite reason: they’re maximally xenharmonic, avoiding the familiar sounds of just intonation almost entirely. A composer who wants a genuinely alien sound palette might find these more useful than the “good” EDOs.
Interestingly, after 79-EDO, the next zeta valley EDO is 5941 — a huge jump. This reflects that as EDOs get larger, it becomes increasingly unlikely for one to be genuinely bad; the probability of accidentally approximating at least some JI ratios well grows with the number of available pitches.
Beyond Records: Local Peaks, Extended Lists, and k-ary Peaks
The strict record-setting criterion is musically too narrow — it excludes many excellent EDOs just because a slightly larger one is fractionally better. Several more permissive categories exist:
Local zeta peak EDOs are those that merely beat their immediate neighbors, not all smaller EDOs. This gives a much richer list: 5, 7, 10, 12, 15, 17, 19, 22, 24, 27, 29, 31, 34, 36, 38, 41, 43, 46, 48, 50, 53, … This is a useful catalog of EDOs worth investigating for composition.
Absolute zeta peak EDOs multiply the zeta score by the size of the EDO, rewarding systems that achieve good approximation in terms of raw cent accuracy rather than efficiency. This gives a larger list: 1, 2, 3, 4, 5, 7, 9, 10, 12, 14, 15, 17, 19, 22, 24, 26, 27, 31, 34, 41, 46, 53, 58, 65, 68, 72, 84, 87, 94, 99, …
k-ary peak EDOs generalize the peak concept: 2-ary peaks are the best EDOs after removing all record holders, 3-ary peaks are the best of what remains after that, and so on. The 2-ary list (6, 8, 9, 14, 15, 17, 24, 34, 46, 58, 65, 77, 87, …) is useful for finding alternatives to a given record EDO — a system with similar size but different musical character.
Optimal Octave Stretch and Zeta Peak Indices
One underappreciated output of the zeta function is a recommendation for optimal octave stretch. Because the peaks of the Z function occur at non-integer values of x, the zeta function is implicitly suggesting that the best version of (say) 12-EDO has a slightly compressed octave — not exactly 1200 cents, but a few hundredths of a cent flat.
This is analogous to the TOP (Tenney-Optimal) tuning in regular temperament theory, though the two don’t generally agree exactly. For each EDO, there’s a table of zeta-recommended octave sizes, which composers using digital synthesis can use to get the most harmonically resonant version of their chosen tuning.
The non-integer peak positions also give rise to a broader concept: zeta peak indices (ZPI), where instead of labeling tunings by EDO number, you label them by their rank in the ordered list of all zeta peaks (including the non-integer ones). This allows a finer-grained exploration of the space of equal temperaments.
Removing Primes: Zeta for Non-Octave Tunings
The zeta function framework also extends naturally to tuning systems that don’t use the octave as their period. By multiplying ζ(s) by appropriate correction factors (specifically, (1 − p^{−s}) for each prime p you want to exclude), you can remove individual primes from consideration.
The most natural application is removing the prime 2 — the octave — to study tunings based on the tritave (the 3:1 ratio). The Bohlen-Pierce scale, for example, divides the tritave into 13 equal steps. Running the modified zeta analysis identifies the best equal divisions of the tritave: 4, 7, 9, 13, 15, 17, 26, 32, 39, 56, 69, 75, 88, 131, … The appearance of 13-EDT (the Bohlen-Pierce scale itself) and its multiples 26 and 39 is particularly striking — the mathematics independently identifies exactly the scale that acousticians designed from first principles.
Why This Matters
The Riemann zeta function in tuning theory is genuinely useful, not just aesthetically pleasing. It provides:
- A systematic ranking of all EDOs without having to specify a prime limit in advance. You don’t have to decide whether 7-limit or 11-limit JI is more important — the zeta function considers all limits simultaneously, weighted by complexity.
- An octave-stretch recommendation for each EDO, giving the tuning that is actually optimal rather than the rounded integer approximation.
- A connection to pure mathematics that has occasionally led to genuine theoretical insights — for example, the connection to harmonic entropy suggests that the mathematical and psychoacoustic criteria for “good” tuning are more deeply related than they might appear.
- Practical lists that musicians can use immediately: the strict zeta EDOs (12, 19, 31, 53, 270, …) are a shortlist of systems worth investing serious compositional energy in.
The important caveat — stated explicitly in the source literature — is that zeta provides a one-dimensional ranking that cannot capture the full richness of what makes a tuning system musically interesting. 16-EDO doesn’t appear on any of these lists, but it has a character all its own. 11-EDO is terrible at approximating 5-limit JI but has an evocative ambiguity that composers have found compelling. The zeta function is a filter, not a verdict.
But as filters go, it’s one of the most mathematically beautiful in any field of applied music theory. The fact that a function defined to count prime numbers in the 19th century turns out to provide an optimal answer to questions about Renaissance music theory is, at minimum, a reminder that mathematics has a habit of turning up exactly where you least expect it.
Further Exploration
If you want to dig deeper:
- The Xenharmonic Wiki has an extensive article on this topic, including derivations, plots, and extended EDO lists. Much of the original theoretical work is due to Gene Ward Smith and Mike Battaglia.
- The Z function around 12edo canbe plotted in Wolfram Cloud with a simple one-liner:
Plot[Abs[RiemannSiegelZ[9.06472028x]], {x, 11.9, 12.1}]— change the bounds to explore other EDOs. - The sequences of zeta peak EDOs are catalogued in the OEIS: A117536 (zeta peak edos), A117538 (zeta integral edos), and A117537 (zeta gap edos).
- Peter Buch’s paper “Favored cardinalities of scales” explores the related question of measuring error against harmonics only, yielding the real part of the zeta function rather than its absolute value.
- Terence Tao has written about Selberg’s limit theorem, which provides theoretical backing for the distribution of the zeta function values that underpin these lists.
- For a broader introduction to the world of non-12 tuning systems, the Xenharmonic Wiki’s articles on regular temperament, equal-step tuning, and optimised regular temperament tunings are excellent starting points.
Whether you’re a mathematician curious about where number theory shows up in the wild, a composer looking for a principled way to choose your next tuning system, or just someone who enjoys the unreasonable effectiveness of mathematics in unexpected places — the Riemann zeta function in music theory is worth your time.
This post is based on material from the Xenharmonic Wiki article on the Riemann zeta function and tuning, which draws on the original theoretical work of Gene Ward Smith and extensions by Mike Battaglia. All mathematical errors are my own.
Comments
Post a Comment