The first time I encountered the West African standard bell pattern it was in a Music and Physics seminar. The lecturer played a twelve-beat cycle on a wood block — seven strokes distributed unevenly but with a rightness that arrested the room. She then played the Cuban clave, the bossa nova timeline, a Bulgarian aksak rhythm. Different cultures, different instruments, different centuries. She asked whether there was a pattern. One modern mathematical description uses an algorithm associated with a mathematician who died around 270 BCE. The music did not acquire its history from Euclid.
Euclid’s Algorithm
Every student who has taken a number theory course has encountered the algorithm for computing the greatest common divisor of two positive integers. Given $a \geq b$, repeatedly replace $(a, b)$ with $(b, a \bmod b)$ until the remainder is zero; the last non-zero remainder is the GCD.
For example, $\gcd(8, 3)$:
$$8 = 2 \times 3 + 2 \;\Rightarrow\; \gcd(8, 3) = \gcd(3, 2)$$$$3 = 1 \times 2 + 1 \;\Rightarrow\; \gcd(3, 2) = \gcd(2, 1)$$$$2 = 2 \times 1 + 0 \;\Rightarrow\; \gcd(2, 1) = 1.$$Three steps, result 1 (8 and 3 are coprime). The algorithm is efficient: the number of steps is proportional to the number of digits in the smaller input. It appears in Book VII of Euclid’s Elements, composed around 300 BCE, making it one of the oldest surviving algorithms in the Greek mathematical record. Calling it “the oldest algorithm in the world” is the title’s joke, not a settled priority claim across all ancient mathematical traditions.
Distributing Onsets: Toussaint’s Observation
In 2005, Godfried Toussaint — a computer scientist and ethnomusicologist at McGill University — published the observation that the problem of distributing $k$ musical onsets as evenly as possible among $n$ time slots has the same recursive structure as Euclid’s algorithm applied to the pair $(k, n-k)$ (Toussaint, 2005).
An algorithm for this distribution problem also arose in accelerator timing. Bjorklund (2003), working on timing systems for the Spallation Neutron Source particle accelerator at Oak Ridge, needed to distribute $k$ beam-extraction pulses as evenly as possible among $n$ machine cycles. The recursive grouping procedure is closely related to Euclidean division. This is an algorithmic comparison, not evidence that a musical timeline, Euclid, and the accelerator system share a historical line of transmission.
The resulting pattern is denoted $E(k, n)$: the Euclidean rhythm with $k$ onsets distributed among $n$ pulses. A 1 denotes an onset; a 0 denotes a rest.
Working Through $E(3, 8)$: The Tresillo
Let us derive $E(3, 8)$ — 3 onsets distributed in 8 pulses — step by step.
Start: 3 onset groups and 5 rest groups:
$$[1]\; [1]\; [1]\; [0]\; [0]\; [0]\; [0]\; [0]$$Step 1: Distribute one rest group into each onset group, pairing until the shorter list is exhausted. Three pairs, with $5 - 3 = 2$ rest groups remaining:
$$[1,0]\; [1,0]\; [1,0]\; [0]\; [0]$$Step 2: Now 3 longer groups and 2 shorter groups. Distribute one shorter group into each longer group, $3 - 2 = 1$ longer group unpaired:
$$[1,0,0]\; [1,0,0]\; [1,0]$$Step 3: The two group types have different lengths and only one group of the shorter type remains; no further pairing is possible. Read the sequence left to right:
$$E(3, 8) = [1, 0, 0, 1, 0, 0, 1, 0].$$This is the Cuban tresillo — one of the foundational rhythmic cells of Afro-Cuban music, used across son, salsa, and mambo. Its onset positions are $\{0, 3, 6\}$, giving gap sizes $[3, 3, 2]$: two wide gaps and one narrow gap, arranged as evenly as the integers allow.
The parallel with Euclid’s algorithm is direct. In the division $8 = 2 \times 3 + 2$, the quotient 2 gives the number of pairing steps before a remainder appears, and the remainder 2 gives the number of groups in the shorter list at each intermediate stage. The recursion $\gcd(8, 3) \to \gcd(3, 2) \to \gcd(2, 1)$ mirrors the three steps above.
The Gap Structure
For any $E(k, n)$, the spacing between consecutive onsets takes exactly two values:
$$\text{gap} \in \left\{\left\lfloor \frac{n}{k} \right\rfloor,\ \left\lceil \frac{n}{k} \right\rceil\right\}.$$The number of each gap size is determined by the constraint that all $k$ gaps sum to $n$. Writing $\alpha = n \bmod k$:
$$\alpha \cdot \left\lceil \frac{n}{k} \right\rceil \;+\; (k - \alpha) \cdot \left\lfloor \frac{n}{k} \right\rfloor = n.$$So $E(k,n)$ has $\alpha$ gaps of the larger size and $k - \alpha$ gaps of the smaller size. The Euclidean property is that these two gap types are distributed as evenly as possible among themselves — not clustered at one end of the cycle. Clough and Douthett’s maximally even sets formalise a stronger distribution property. Depending on convention, Euclidean constructions and maximally even sets agree up to rotation in the examples here; maximising only the smallest adjacent gap does not uniquely determine a pattern.
For $E(3, 8)$: $\lfloor 8/3 \rfloor = 2$, $\lceil 8/3 \rceil = 3$, $\alpha = 8 \bmod 3 = 2$. Two gaps of 3, one gap of 2. Gap sequence $[3, 3, 2]$. Maximum-evenness is why the tresillo sounds “right” even though it is asymmetric: the asymmetry is the smallest possible deviation from perfect regularity.
A Gallery of World Rhythms
The following table, derived from Toussaint (2005, 2020), shows Euclidean rhythms alongside their ethnomusicological identifications. Asterisks mark patterns given as rotations of the canonical form.
| Pattern | Gap structure | Musical tradition |
|---|---|---|
| $E(2,3) = [1,0,1]$ | $[2,1]$ | Iambic foot; West African, Balkan |
| $E(3,8) = [1,0,0,1,0,0,1,0]$ | $[3,3,2]$ | Cuban tresillo; Flamenco |
| $E(5,8) = [1,0,1,1,0,1,1,0]$ | $[2,1,2,1,2]^*$ | Cuban cinquillo |
| $E(4,9) = [1,0,0,1,0,1,0,1,0]^*$ | $[3,2,2,2]^*$ | Turkish aksak patterns |
| $E(7,12) = [1,0,1,1,0,1,0,1,1,0,1,0]$ | $[2,1,2,2,1,2,2]^*$ | West African standard bell |
Three of these are worth examining in more detail.
$E(5,8)$: the cinquillo. Five onsets in eight pulses: $\lfloor 8/5 \rfloor = 1$, $\lceil 8/5 \rceil = 2$, $\alpha = 3$. Three gaps of 2 and two gaps of 1. Gap sequence $[2,1,2,1,2]$ or a rotation thereof. The cinquillo is a fundamental pattern in Cuban music, used as a melodic rhythmic figure in the nineteenth-century contradanza and in much of what followed.
$E(7,12)$: the West African standard bell. Seven onsets in a twelve-beat cycle: $\lfloor 12/7 \rfloor = 1$, $\lceil 12/7 \rceil = 2$, $\alpha = 5$. Five gaps of 2 and two gaps of 1. Toussaint compares a rotation of this binary distribution with a standard-bell timeline documented in West African repertoires. A rotation of the same maximally even 7-in-12 gap pattern also describes the diatonic pitch-class set. That is a statement about cyclic spacing, not equivalence between a bell timeline and a Western scale.
Toussaint compares the 3-in-8 distribution with timelines in several traditions. Binary similarity alone cannot show independent invention, common ancestry, or transmission. It also discards accent, swing, timbre, metre, tempo, and the social function that make a rhythm part of a particular practice.
Circular Notation and Necklaces
Euclidean rhythms are most naturally represented as necklaces — equivalence classes of binary sequences under cyclic rotation. Mathematically, rotations of $E(3,8)$ belong to one necklace. Musically, changing the downbeat can change accent, metre, and identity; necklace equivalence deliberately ignores that information.
In circular notation, place $n$ equally spaced dots on a circle and mark the $k$ onset positions. The pattern is immediately visible: the $k$ onset-dots divide the circle as evenly as possible. For $E(7,12)$, the seven onset dots on a twelve-position circle look like the seven vertices of a near-regular heptagon inscribed in a dodecagon. For $E(3,8)$, the three onset dots form a near- equilateral triangle.
This geometric representation makes the maximum-evenness property transparent in a way that the linear binary string does not. It also makes clear why Euclidean rhythms feel “balanced” when played: the onset dots distribute the “weight” of the cycle as uniformly as the integer constraints allow.
The mathematical theory of necklaces belongs to combinatorics on words. For coprime counts and suitable upper/lower and rotation conventions, these balanced binary patterns are related to Christoffel words (Lothaire, 2002): words over the alphabet $\{0,1\}$ whose combinatorial properties encode the slope of a line segment, which brings us to the third independent context in which the same algorithm appears.
The Bresenham Connection
Jack Bresenham’s line algorithm (1965) rasterises a line from $(0,0)$ to $(n,k)$ on a grid of integer pixels. At each column $x$, the algorithm tracks whether the fractional error accumulated since the last row increment exceeds $\frac{1}{2}$, and if so, increments the row and resets the error. The sequence of column positions at which the row increments is the onset pattern $E(k,n)$.
Formally, an onset occurs at position $m$ in $E(k,n)$ if and only if:
$$\left\lfloor \frac{(m+1)\, k}{n} \right\rfloor > \left\lfloor \frac{m\, k}{n} \right\rfloor.$$Equivalently, the onset positions themselves form the sequence:
$$s_j = \left\lfloor \frac{j \cdot n}{k} \right\rfloor, \qquad j = 0, 1, \ldots, k-1.$$For $E(3,8)$: $s_0 = 0$, $s_1 = \lfloor 8/3 \rfloor = 2$, $s_2 = \lfloor 16/3 \rfloor = 5$, giving onset positions $\{0, 2, 5\}$ — a rotation of the tresillo.
This is exactly the Bresenham increment condition. Drawing the line from $(0,0)$ to $(8,3)$ and marking where the $y$-coordinate takes a step produces the onset positions $\{2, 5, 7\}$ — a rotation of the tresillo $\{0, 3, 6\}$.
The retrospective comparison joins ancient Greek number theory, binary rhythm analysis, accelerator timing, and computer graphics around a discrete distribution problem. It does not imply that performers generated their music by executing Euclid’s or Bresenham’s procedure.
Euclidean Rhythms in Contemporary Practice
Toussaint’s 2005 paper was a contribution to computational ethnomusicology. Euclidean rhythm generators also appear in hardware and software sequencers. A common interface exposes $k$, $n$, and a rotation offset. Product availability and implementation conventions vary, so this is a design pattern rather than a timeless inventory.
This has opened a compositional mode in which the mathematical structure is operational: a producer can stack several generated patterns and listen to their interaction. Calling the result “African-style” from binary spacing alone would erase the performance practices the algorithm does not encode.
Implications for Teaching Rhythm
Music conservatories in the European tradition teach rhythm almost entirely through Western notation: time signatures, note values, dotted notes, ties. This system is well-suited to the repertoire it was designed for. It handles Euclidean rhythms awkwardly. The tresillo $E(3,8)$ requires either a triplet feel against a binary pulse or a notation involving a dotted quarter note followed by a dotted quarter and a quarter, which correctly represents the sound but obscures the structural principle entirely.
The Euclidean framework suggests a different pedagogical starting point. Rather than beginning from the bar line and asking how notes fill it, begin from the cycle length $n$ and the onset count $k$ and ask how to distribute the onsets as evenly as possible. The answer is computable, but whether the result is recognised as a particular rhythm depends on rotation, accent, tempo, and context.
For students who encounter West African, Afro-Cuban, or Middle Eastern music — which conservatory students increasingly do — having a framework that makes these rhythms as cyclic structures rather than deviations from one notational norm can be useful. The tresillo comparison is a maximally even 3-in-8 necklace, with rotations and performance details still to choose. The mathematics explains the spacing criterion. It does not explain why a culturally situated performance sounds right.
Whether conservatory curricula are ready to incorporate the Euclidean framework alongside Western notation is a separate question. The mathematics does not demand it. But it offers a language for rhythm that transcends the Western bar-line without abandoning precision — and that seems worth something, especially in a world where the music students will perform and teach is no longer exclusively European.
Mathematical and music-historical sources checked through 2026-07-11.
References
Bjorklund, E. (2003). The theory of rep-rate pattern generation in the SNS timing system. Technical Report SNS-NOTE-CNTRL-99, Spallation Neutron Source, Oak Ridge National Laboratory.
Bresenham, J. E. (1965). Algorithm for computer control of a digital plotter. IBM Systems Journal, 4(1), 25–30. https://doi.org/10.1147/sj.41.0025
Clough, J., & Douthett, J. (1991). Maximally even sets. Journal of Music Theory, 35(1–2), 93–173. https://doi.org/10.2307/843811
Lothaire, M. (2002). Algebraic Combinatorics on Words. Cambridge University Press.
Toussaint, G. T. (2005). The Euclidean algorithm generates traditional musical rhythms. In R. Sarhangi & J. Sharp (Eds.), Proceedings of BRIDGES 2005: Mathematical Connections in Art, Music, and Science (pp. 47–56). Bridges Conference.
Toussaint, G. T. (2020). The Geometry of Musical Rhythm: What Makes a “Good” Rhythm Good? (2nd ed.). Chapman & Hall/CRC Press.
Changelog
- 2026-07-11: Corrected the algorithm-priority, maximal-evenness, necklace, Christoffel-word, product, and teaching claims; removed erroneous table rows; and made cultural timeline comparisons explicitly non-genealogical.