As evenly as possible, which turns out to be a famous rhythm
Three strikes to place over eight beats. Spacing them perfectly evenly would need 2.67 beats between each, which is not available. The best that can be done is 3, 3, 2.
There are three arrangements of those gaps up to rotation, and one of them — starting on the beat, gaps of 3, 3, 2 — is the tresillo: the rhythmic foundation of Cuban son, of Brazilian music, of ragtime, and by descent of a large fraction of everything on the radio.
The algorithm was not given any of those names. It was given two numbers.
The algorithm
The method is due to E. Bjorklund, who published it in 2003 for a completely unrelated purpose: timing the firing of neutron accelerator spallation targets, where pulses need to be spread as evenly as possible over a cycle.
It works by repeated grouping. To place 5 onsets over 8 steps, start with five ones and three zeros:
1 1 1 1 1 0 0 0
Pair each zero with a one, leaving the surplus ones as a remainder:
10 10 10 1 1
Now do the same again — pair each remainder group with a leading group:
10 1 10 1 10
The remainder is exhausted, and reading the digits gives 10110110 — which is the cinquillo, another cornerstone of Caribbean music.
The recursive structure is exactly Euclid’s algorithm for the greatest common divisor, which is why the results are called Euclidean rhythms. It is the same procedure of repeatedly taking a remainder, run on groups instead of on numbers.
What comes out
The list is the interesting part, and it is worth reading slowly.
E(2,5) gives x.x.. — a Persian rhythm, and also the khafif-e-ramal.
E(3,8) gives x..x..x. — the tresillo, and the Cuban habanera pattern.
E(5,8) gives x.xx.xx. — the cinquillo.
E(4,9) gives x.x.x.x.. — a Turkish aksak.
E(5,12) gives x..x.x..x.x. — a West African bell pattern.
E(7,16) gives x..x.x.x..x.x.x. — a Brazilian necklace pattern.
Six numbers pairs in, six named traditional rhythms out. The full list runs to dozens, covering Bulgarian, Persian, Indian, Ghanaian, Colombian and Turkish patterns, and it was compiled by Godfried Toussaint, who noticed the coincidence in 2004 and wrote the survey that made it known.
What the coincidence proves, and what it does not
The temptation is to conclude that human rhythm is generated by an evenness principle. That is too strong, and the weaker version is more interesting.
What is fair to say: maximally even distributions are a small set, they are easy to produce, they are easy to remember, and they are distinctive. Any tradition looking for a repeating pattern of k strikes in n beats has a strong reason to land on one — it is the most stable and most memorable option in the space.
What is not fair to say: that these rhythms are Euclidean rhythms, or that the algorithm explains them. Toussaint’s own framing is careful about this and the popular retelling usually is not.
The specific problems:
Rotation is thrown away. E(3,8) generates a necklace. Which rotation is the tresillo is a musical fact the algorithm has no view on, and rotations of the same necklace are different rhythms with different names and different feels.
Most rhythms are not maximally even. For every match in the list there are many traditional patterns that are not Euclidean at all. The clave patterns of Cuban music — the actual clave, not the tresillo inside it — are not maximally even, and they are more central to the tradition than most of the matches.
Small numbers. For small n and k there are very few patterns available, so hitting a real one is not statistically remarkable. E(3,8) has only three distinct necklaces to choose from.
The instruments are missing. A real bell pattern is played on a bell with a particular timbre, against other parts, at a particular tempo, with microtiming that is not on any grid. The onset list is a shadow of it.
The same principle in pitch
The reason this is more than a curiosity is that the identical construction generates the scales.
Ask for seven positions out of twelve, as evenly spaced as possible. The answer is the major scale — gaps of 2, 2, 1, 2, 2, 2, 1, which is exactly the diatonic pattern.
Ask for five out of twelve and the answer is the pentatonic scale. Ask for five out of eight in rhythm and the answer is the cinquillo. The constructions are identical; only the interpretation of the cycle differs.
This is not a mystical correspondence. It is one combinatorial fact — that a maximally even distribution of k items over n positions is unique up to rotation, and has a simple recursive construction — applied to two different cyclic domains. Scales and rhythms are both selections from a cycle, so of course the same question has the same answer.
It does, though, explain why the two subjects keep producing structurally parallel results, and why modes and rhythmic rotations behave so similarly.
Why evenness is a good property
Setting aside whether traditions used the algorithm, there are real reasons a maximally even pattern is a good pattern.
Memorability. A pattern with two gap sizes is easier to remember than one with four. Maximally even patterns have exactly two, which is the minimum possible when the division is uneven.
Stability under rotation. Every rotation of a maximally even pattern is also maximally even, so an ensemble whose parts enter at different points in the cycle produces something coherent from every entry point.
Interlocking. Two maximally even patterns of different densities over the same cycle interlock without clustering — their onsets spread out rather than piling up. For ensemble music built from layered parts, that is exactly the property wanted.
Distinguishability. A pattern with two gap sizes in an asymmetric arrangement can be located: a listener can tell where in the cycle they are, for the same reason that an uneven scale has landmarks and an even one does not.
Whose music, and when
The patterns are widely distributed and the distribution is not evidence of contact.
The tresillo appears in West African music, in Cuban son, in Brazilian choro, in New Orleans ragtime and in Argentine tango. Some of those connections are historically documented and travelled with the Atlantic slave trade. Others are almost certainly independent, because there are only three patterns available and a tradition that wants three strikes in eight beats will find one of them.
Toussaint’s survey deliberately included patterns from traditions with no plausible contact — Persian, Bulgarian, Ghanaian, Colombian — to make exactly that point. The distribution is what a small combinatorial space predicts, not what diffusion predicts — and rotations of one necklace account for several of the apparent matches on their own.
The proper conclusion is modest and worth stating: the space of good repeating patterns of a few strikes in a few beats is very small, and traditions everywhere have explored it thoroughly. The convergence is a fact about the size of the space.
Two sizes, again
The maximally even patterns share a property with the scales, and it is the same property.
A maximally even distribution of k onsets over n steps has at most two distinct gap sizes, and they differ by one. E(3,8) has gaps of 3 and 2. E(5,12) has gaps of 3 and 2. E(7,16) has gaps of 3 and 2.
Never three sizes. That is what maximal evenness means in practice, and it is exactly the two-sizes property that makes the diatonic scale learnable: an interval class comes in a large version and a small version, and never in three.
The consequence for rhythm is the same as for pitch. A pattern with two gap sizes can be held in memory as a short instruction — three, three, two — where a pattern with four sizes has to be memorised event by event. Maximal evenness is, among other things, a compression.
Where it fails, and why that is useful
The cases the algorithm gets wrong are more informative than the cases it gets right, and the most important one is the clave.
The son clave is x..x..x...x.x... over sixteen steps — five onsets, and it is the organising pattern of Cuban music and a great deal of what descends from it. Run the algorithm: E(5,16) gives x..x..x..x..x..., which is not the clave. The gaps are 3-3-3-3-4 rather than the clave’s 3-3-4-2-4.
The clave is not maximally even, and it is more central to its tradition than any of the patterns that are. Whatever makes it work is not evenness.
What does appear to matter is its asymmetry. The clave divides its sixteen steps into two halves of eight, with three onsets in one half and two in the other — the “three-two” or “two-three” orientation, which is a real distinction that musicians argue about and which determines how everything else in the ensemble aligns. A maximally even pattern has no such division, because it is as uniform as possible by construction.
So evenness produces patterns that are stable and memorable, and the tradition that matters most here reached for something else: a pattern with internal asymmetry that gives the cycle a shape and a direction. Which is the same reason an even scale is useless — a pattern that looks the same from everywhere cannot tell a listener where they are.
What the algorithm cannot know
Two things are missing from the output, and both of them are where the music is.
Which rotation. The construction produces a necklace, and a necklace is not a rhythm until somebody decides where it starts. That decision determines the name, the feel, and how everything else in an ensemble aligns to it, and no amount of arithmetic supplies it.
Which cycle length. E(3,8) and E(6,16) generate the same relative pattern at different resolutions. Whether a tradition thinks in eight or in sixteen affects what subdivisions are available for ornament and displacement, and the choice is not derivable from the onsets.
Both omissions have the same character: the algorithm is good at the part that is combinatorial and silent about the part that is conventional. That is a reasonable division of labour, provided nobody claims the combinatorial part is the whole thing.
Where the model stops
Onsets only, on a grid. Every pattern here is a binary string on equally spaced positions. Real playing has swing, microtiming, dynamics, timbre and duration, all of which are rhythmically load-bearing and none of which is represented.
No rotation. The algorithm produces a necklace and music uses a specific rotation. That is a significant amount of the musical content, and it is not in the output.
Cherry-picking is possible. Presenting six matches is a selection. A fair test would state how many Euclidean patterns have no traditional counterpart and how many traditional patterns are not Euclidean, and both numbers are substantial.
One layer. Real ensemble rhythm is several patterns at once with defined relationships between them. This essay’s figures show one at a time, apart from the last.
The construction, generalised
The procedure has a description that makes its behaviour obvious, and it is worth having.
Placing k onsets among n steps as evenly as possible is the same as choosing, for each from 0 to , the step
For k = 3 and n = 8 that gives 0, 2, 5 — which is the tresillo up to rotation. For k = 7 and n = 16 it gives 0, 2, 4, 6, 9, 11, 13.
That formula is the same object as Bjorklund’s recursion and as Euclid’s algorithm, and it is also the algorithm a computer graphics system uses to draw a straight line on a pixel grid. A line of slope k/n rasterised onto n pixels lights exactly the pixels the rhythm strikes.
The connection is not a coincidence and it is not deep: all three are the problem of distributing k things among n slots as regularly as possible, and there is only one good answer. It does mean that a Bresenham line-drawing routine, run on the right slope, emits the tresillo.
The same shape in three domains
Collecting the appearances is the strongest argument for the construction being fundamental rather than musical.
In rhythm, maximal evenness gives the tresillo, the cinquillo, the aksak patterns and the West African bell patterns.
In pitch, the same construction gives the diatonic and pentatonic scales — seven of twelve and five of twelve, maximally even.
In neither, it gives the timing of accelerator pulses, the spacing of pixels on a rasterised line, and the scheduling of tasks that should not clump.
The right conclusion is that music has repeatedly found a good solution to a general problem, not that music is generated by the problem. A tradition that wants a repeating pattern of a few strikes has a small space to search and a strong reason to prefer the even ones, and traditions found them because they were there.
Why a small space gets explored completely
The convergence across unconnected traditions is worth one more paragraph, because the explanation generalises well beyond rhythm.
For three onsets in eight steps there are, up to rotation, exactly three distinct necklaces. For five in eight there are five. These are not large numbers, and a tradition that spends centuries playing repeating patterns will find all of them.
So convergence is what a small space predicts, and it needs no contact, no shared origin and no universal cognitive principle. The same argument applies to seven notes out of twelve, where sixty-six possibilities is small enough that independent traditions arriving at the same one is unremarkable.
What would be remarkable is convergence in a large space — and the traditions do diverge sharply exactly where the space opens up, which is in the melodic behaviour, the ornamentation and the ensemble organisation that no combinatorial account touches.
The ladder from here
Later rungs: Bjorklund’s algorithm derived properly, and its identity with Euclid’s. Maximal evenness in scale theory. Rotation, and why the tresillo is one specific rotation. Clave, and the patterns that are not maximally even. Toussaint’s survey and its methodology. Interlocking parts in West African ensemble music. Microtiming, measured. Swing ratios. And the deep question of whether rhythmic and pitch structure share a cognitive mechanism, which the mathematical parallel raises and does not answer.
Bjorklund was solving a problem in neutron spallation source timing, and the paper contains no music at all. The algorithm reached music because Toussaint read the paper and recognised the output.