Petty's Notebook
ArticlesPapersnfieldAbout
Get notified when new posts are published. No spam, just math.
Alexander S. Petty  |  ©2009-2026
← Back
Alignment

Primes and the Major Scale

October 31, 202015 min read
Companion paper: The Alignment Deficit Lattice and Musical Tuning →
Blue contours meet in a measured rhythm, and selected coincidences carry a gold phrase across the field. Prime-ratio relationships become the intervals of just intonation.
Blue contours meet in a measured rhythm, and selected coincidences carry a gold phrase across the field. Prime-ratio relationships become the intervals of just intonation.

I have been a musician for most of my life. I have also spent most of my life hearing that the golden ratio explains music. The explanations I encountered failed on contact with the mathematics, but I kept looking. After years of working on the question, I found a connection through repeating decimals. I call it the alignment-deficit lattice.

Here is the short version. For certain families of fractions, the share that lines up with the first fraction creeps toward a limit, and the amount still missing is a small, exact fraction. I call that amount the deficit. Divide one deficit by another and you get a ratio, and in the right base those ratios become the octave, the fifth, the major third and the other intervals a musician tunes by, and eventually the whole major scale. Which intervals you get depends on the primes in the base. Decimal, it turns out, cannot play a fifth.

The deficit below two thirds

Start with the twelfths, which set the upper edge of the empty band in The Three-Tier Theorem. Of the eleven proper twelfths, four eventually repeat the same digit as 1/121/121/12, and three more terminate and take a whole credit under the alignment convention. Seven credits among eleven fractions gives an alignment of 7/117/117/11.

Twelve belongs to a family. Every denominator 3m3m3m with mmm built only from 2s and 5s behaves the same way, and its alignment is

α10(3m)=2m−13m−1.\alpha_{10}(3m)=\frac{2m-1}{3m-1}.α10​(3m)=3m−12m−1​.

Every repeating tail in this family is a single digit, a 3 or a 6, so once the opening digits are cleared a row either matches the reference forever or never matches it at all. That keeps the counting simple.

As mmm grows, the alignment climbs toward 2/32/32/3 without ever getting there. The distance still to go is the deficit.

δ3(m)=23−α10(3m)=13(3m−1).\begin{aligned} \delta_3(m)&=\frac23-\alpha_{10}(3m)\\ &=\frac{1}{3(3m-1)}. \end{aligned}δ3​(m)​=32​−α10​(3m)=3(3m−1)1​.​

At m=4m=4m=4 the deficit is 1/331/331/33. Double mmm to 8 and it drops to 1/691/691/69, and doubling again gives 1/1411/1411/141. Each doubling leaves a little less than half the previous deficit.

The alignment 7/11 stops 1/33 short of two thirds. Five bars show the deficits at m equal to 4, 8, 16, 32 and 64 on a common scale. Two copies of 1/69 fall short of 1/33 by exactly 1/759. The alignment 7/11 stops 1/33 short of two thirds. Five bars show the deficits at m equal to 4, 8, 16, 32 and 64 on a common scale. Two copies of 1/69 fall short of 1/33 by exactly 1/759.
The gold bar is the missing part of the alignment. Enlarging it reveals what doubling does. Two copies of the next deficit almost fill the first, with exactly 1/759 left over. Their ratio is 23/11, just above the octave.

Divide one deficit by the next and you get 69/33=23/1169/33=23/1169/33=23/11, a bit more than 2. The next pair gives 47/2347/2347/23, closer still, and the ratios keep closing in on exactly 2. Any musician knows that number. Two to one is the octave, the same note again with the string half as long.

So each doubling of mmm plays an octave, slightly sharp at every finite step, and the formula says exactly how sharp.

The fifth that decimal cannot supply

Nothing here depends on the prime 3 in particular. Take any prime p≥3p\geq3p≥3 that divides b−1b-1b−1, which is what keeps every repeating tail down to a single digit, and let mmm be built from the primes of the base bbb. The alignment of pmpmpm climbs toward 2/p2/p2/p, and the deficit is

δp(m)=p−2p(pm−1).\delta_p(m)=\frac{p-2}{p(pm-1)}.δp​(m)=p(pm−1)p−2​.

The thing to notice is the mmm in the denominator. Deficits shrink like one over mmm, so the ratio of two deficits behaves like the ratio of their integers turned upside down. Scale both integers by the same factor ttt, made from the base’s primes, and the ratio settles on it exactly.

δp(tu)δp(tv)=ptv−1ptu−1⟶vu.\frac{\delta_p(tu)}{\delta_p(tv)} =\frac{ptv-1}{ptu-1} \longrightarrow\frac vu.δp​(tv)δp​(tu)​=ptu−1ptv−1​⟶uv​.

The smaller integer goes on top because its deficit is the larger one. The two subtracted ones keep every finite ratio a hair away from v/uv/uv/u, and they fade as ttt grows.

That is how integers become pitches. In decimal the integers we may use are products of 2 and 5, so the available intervals are ratios of those. The 2s give octaves, and the 5 gives the just major third, 5/45/45/4, the pair 40 and 50 for instance. A fifth above 40 would need 60, and 60 has a factor of 3.

No amount of multiplying and dividing by 2 and 5 ever produces exactly 3/23/23/2. There is a 3 in the denominator 3m3m3m, but that 3 chooses the alignment family. The integers themselves have to come from the base, and decimal only has 2 and 5 to give. A clever choice of pair can get close to a fifth, but no fixed pair has 3/23/23/2 as its limit.

Base 12 has both 2 and 3. The prime 11 divides 12−112-112−1, so p=11p=11p=11 takes over the job that 3 did in decimal, and the allowed integers sit on a grid with one axis for each prime. A step to the right multiplies by 2, and a step up multiplies by 3.

Two prime-exponent grids. In decimal the route 40 to 20 to 10 to 50 gives 5/4, but 60 requires an unavailable factor of 3. In base twelve, 24 to 12 to 36 is one step left and one step up, giving the fifth 3/2. Two prime-exponent grids. In decimal the route 40 to 20 to 10 to 50 gives 5/4, but 60 requires an unavailable factor of 3. In base twelve, 24 to 12 to 36 is one step left and one step up, giving the fifth 3/2.
Each line is an allowed multiplication or division. Decimal can reach 50 from 40, the major third, but a fifth would require the missing prime 3. Base twelve supplies that direction. From 24, divide by 2 and multiply by 3 to reach 36.

From 24, one step left and one step up lands on 36. Dividing by 2 and multiplying by 3 is the fifth, 3/23/23/2. These are the same prime-exponent coordinates Pythagorean tuning has always used. What the alignment count adds is a number at every point on the grid, and an exact formula for how close two of those numbers come to the interval between them.

Twelve fifths and seven octaves

Twelve pure fifths take us almost, but not quite, to the same pitch as seven octaves. The discrepancy is small enough to disappear in a rough calculation and large enough to cause centuries of trouble in tuning.

Twelve fifths multiply the frequency by (3/2)12(3/2)^{12}(3/2)12, and seven octaves multiply it by 272^727. The ratio between the two endpoints is

(3/2)1227=312219=531441524288.\frac{(3/2)^{12}}{2^7} =\frac{3^{12}}{2^{19}} =\frac{531441}{524288}.27(3/2)12​=219312​=524288531441​.

This is the Pythagorean comma, about 23.46 cents. A semitone in twelve-tone equal temperament is 100 cents, so the gap is almost a quarter of one. Pure fifths make a spiral, not a closed circle. Equal temperament narrows each fifth by a twelfth of the comma so that twelve of them land exactly on seven octaves. Benson follows the arithmetic of the mismatch.

Both integers in that fraction, 3123^{12}312 and 2192^{19}219, are allowed points in base 12, so we can put their deficits straight into the ratio formula.

δ11(524288)δ11(531441)=58458505767167.\frac{\delta_{11}(524288)}{\delta_{11}(531441)} =\frac{5845850}{5767167}.δ11​(531441)δ11​(524288)​=57671675845850​.

The finite ratio comes out slightly larger than the comma, and the two already agree through eight decimal places.

A pitch spiral marks twelve pure fifths in teal and seven octaves on a gold ray. The twelfth fifth passes the seventh octave. A second bar shows the 23.46-cent gap at its actual proportion of a 100-cent semitone. A pitch spiral marks twelve pure fifths in teal and seven octaves on a gold ray. The twelfth fifth passes the seventh octave. A second bar shows the 23.46-cent gap at its actual proportion of a 100-cent semitone.
Each revolution is an octave, and each teal dot adds a pure fifth. After twelve fifths the spiral misses the seventh octave by 23.46 cents. The bar below shows that gap against a whole semitone. Scaling the deficit coordinates removes their extra error, not the classical comma.

Scale both points together and the ratio converges to the comma itself. The deficits don’t smooth the problem away the way equal temperament does. They reproduce the pure intervals, spiral and all.

Eight notes from nine points

Base 30=2×3×530=2\times3\times530=2×3×5 adds a third axis, for 5. With p=29p=29p=29, the deficits now live on the grid of five-limit just intonation, the tuning in which no prime larger than 5 appears in any interval.

The just major scale, Do Re Mi Fa Sol La Ti Do, has the ratios

1,98,54,43,1,\quad\frac98,\quad\frac54,\quad\frac43,1,89​,45​,34​, 32,53,158,2.\frac32,\quad\frac53,\quad\frac{15}{8},\quad2.23​,35​,815​,2.

Put them over their common denominator, 24, and the scale becomes eight integers, 24, 27, 30, 32, 36, 40, 45 and 48, each built from 2, 3 and 5. That is a classical way to write the scale, also set out in Kurenniemi’s account of musical lattices.

One more integer between 24 and 48 is made from the same primes, 25=5225=5^225=52.

A projection of a three-dimensional prime-exponent lattice highlights the eight just-major-scale integers in gold and the extra point 25 in teal. Below, a pitch staircase and seven proportional bars show the unequal whole tones 9/8 and 10/9 and the semitone 16/15. A projection of a three-dimensional prime-exponent lattice highlights the eight just-major-scale integers in gold and the extra point 25 in teal. Below, a pitch staircase and seven proportional bars show the unequal whole tones 9/8 and 10/9 and the semitone 16/15.
Three prime directions supply nine integers between 24 and 48. The eight gold points form the familiar scale. The teal point, 25, is just as legitimate arithmetically. Below the lattice, horizontal distances measure pitch in cents. The two whole tones have visibly different widths.

Its interval, 25/2425/2425/24, belongs to the lattice but not to the familiar scale. The arithmetic hands us nine points, and picking the eight that make a major scale is still a musician’s choice.

Divide each note by the one before it and the steps are 9/89/89/8, 10/910/910/9, 16/1516/1516/15, 9/89/89/8, 10/910/910/9, 9/89/89/8 and 16/1516/1516/15. That is the whole, whole, half, whole, whole, whole, half pattern every piano student learns, except that in this tuning the whole steps come in two sizes, 9/89/89/8 and 10/910/910/9.

The fifth’s extra fraction

The finite column in the table below comes straight from the deficits. Divide the deficit at 24 by the deficit at each note and you get (29m−1)/695(29m-1)/695(29m−1)/695. For the fifth, m=36m=36m=36, and

1043695=32+11390.\frac{1043}{695}=\frac32+\frac{1}{1390}.6951043​=23​+13901​.

That extra 1/13901/13901/1390 makes this fifth a little wide. Every note above unison is a little wide, and the octave is the widest, off by just under 0.072 percent.

Multiply both ends of the fifth, 24 and 36, by the same allowed factor ttt and the excess becomes

δ29(24t)δ29(36t)=32+12(696t−1).\frac{\delta_{29}(24t)}{\delta_{29}(36t)} =\frac32+\frac{1}{2(696t-1)}.δ29​(36t)δ29​(24t)​=23​+2(696t−1)1​.

Each tenfold increase in ttt buys roughly another decimal place, and the same holds for every interval in the scale.

Three tuning needles on the same plus-or-minus-one-cent range show the finite fifth's error at starting points 24, 480 and 24000. The errors are 0.8301, 0.0415 and 0.0008 cents. A logarithmic graph below shows all scale-note relative errors; unison is exactly zero. Three tuning needles on the same plus-or-minus-one-cent range show the finite fifth's error at starting points 24, 480 and 24000. The errors are 0.8301, 0.0415 and 0.0008 cents. A logarithmic graph below shows all scale-note relative errors; unison is exactly zero.
All three needles use the same range, one cent to either side of a pure fifth. Scaling the starting point brings the needle toward zero. Below, the outlined Sol points trace that same fifth through the scale’s relative-error curves. Unison remains exact and is not plotted on the logarithmic axis.

An octave-wide plot would hide most of the change, so the lower panel measures relative error in parts per million on a logarithmic scale. Follow Sol down the three curves and you can watch the fifth close in on 3/23/23/2. Do has no error at all, since its deficit is divided by itself.

A seventh in base 210

The primes in the base decide the grid. Bases 6, 12 and 24 all have 2 and 3, so they share the Pythagorean intervals in the limit. Bases 30, 60 and 120 have 2, 3 and 5. Their finite values can differ, because the prime ppp enters the formula too, but the limits agree.

Base 210=2×3×5×7210=2\times3\times5\times7210=2×3×5×7 keeps all of that and adds 7. With p=11p=11p=11, which divides 209, the deficit ratios at 4t4t4t and 7t7t7t approach the harmonic seventh, 7/47/47/4, the low seventh that barbershop quartets lean into. The pair 7t7t7t and 8t8t8t approaches the septimal whole tone, 8/78/78/7. Neither interval exists without the 7.

The tuning lattice is classical, and any positive function that behaves like a constant divided by mmm would recover its limiting ratios. What is particular here is where this one comes from, a count of repeating tails, with an exact correction at every finite step. To my knowledge, this coordinate has not been previously described.

At the fifth, that count gives 1043/6951043/6951043/695. Subtract the musical ratio 3/23/23/2 and exactly 1/13901/13901/1390 remains. We can account for that fraction and make it as small as we please by scaling the two integer points together.

I wanted a connection that would survive contact with the mathematics. Here, even the part that is still out of tune has an exact value.

The one-digit count in any supported base

Let p≥3p\geq3p≥3 be prime with p∣b−1p\mid b-1p∣b−1, and let mmm be a positive integer whose prime factors all divide bbb. Choose a clearing length DDD with m∣bDm\mid b^Dm∣bD. Among the pm−1pm-1pm−1 proper fractions k/(pm)k/(pm)k/(pm), there are m−1m-1m−1 terminating rows. Each receives a whole credit by convention.

For the other rows, multiplication by bbb preserves the remainder modulo ppp, since b≡1(modp)b\equiv1\pmod pb≡1(modp). Their cleared tails repeat a single digit. The mmm rows with k≡1(modp)k\equiv1\pmod pk≡1(modp) share the tail of 1/(pm)1/(pm)1/(pm). The remaining (p−2)m(p-2)m(p−2)m rows do not. Thus

αb(pm)=(m−1)+mpm−1,\alpha_b(pm)=\frac{(m-1)+m}{pm-1},αb​(pm)=pm−1(m−1)+m​, δp(m)=2p−αb(pm)=p−2p(pm−1).\delta_p(m)=\frac2p-\alpha_b(pm) =\frac{p-2}{p(pm-1)}.δp​(m)=p2​−αb​(pm)=p(pm−1)p−2​.

For example, take base 12, p=11p=11p=11 and m=2m=2m=2. The denominator is 22. After one digit, 1/221/221/22 repeats the digit 6. Rows 1 and 12 match that tail; row 11 terminates. The alignment is 3/21=1/73/21=1/73/21=1/7, and its deficit from 2/112/112/11 is 3/773/773/77.

The exact difference from a limiting ratio is

ptv−1ptu−1−vu=v−uu(ptu−1).\frac{ptv-1}{ptu-1}-\frac vu =\frac{v-u}{u(ptu-1)}.ptu−1ptv−1​−uv​=u(ptu−1)v−u​.

It is positive when v>uv>uv>u. The finite interval approaches its target from above. The limit is taken along allowed factors ttt, such as successive powers of any prime dividing the base.

Exact scale values and the fifth’s convergence

The last column is δ29(24)/δ29(m)\delta_{29}(24)/\delta_{29}(m)δ29​(24)/δ29​(m). The just interval in the middle column is its limit when both points are scaled together.

Note mmm Just interval Finite ratio
Do 24 111 111
Re 27 9/89/89/8 782/695782/695782/695
Mi 30 5/45/45/4 869/695869/695869/695
Fa 32 4/34/34/3 927/695927/695927/695
Sol 36 3/23/23/2 1043/6951043/6951043/695
La 40 5/35/35/3 1159/6951159/6951159/695
Ti 45 15/815/815/8 1304/6951304/6951304/695
Do 48 222 1391/6951391/6951391/695

For a selected point mmm between 24 and 48, the relative error after scaling by ttt is (m−24)/(m(696t−1))(m-24)/(m(696t-1))(m−24)/(m(696t−1)). Its maximum occurs at 48 and equals 1/[2(696t−1)]1/[2(696t-1)]1/[2(696t−1)]. At t=1t=1t=1, the bound is 1/13901/13901/1390. The fifth’s absolute error is also 1/13901/13901/1390 at this scale, but its relative error is 1/20851/20851/2085.

Here is the fifth at six starting points. The displayed decimal values are rounded.

Starting point m0m_0m0​ Deficit ratio at 3m0/23m_0/23m0​/2
24 1.500719
240 1.500072
2400 1.500007
24000 1.5000007
240000 1.50000007
2400000 1.500000007
Twelve windows into the tuning lattice
Twelve complete octave-folded pitch diagrams compare bases 10, 12, 30 and 210 across exponent windows from minus one to one, minus three to three, and minus seven to seven. Colored edges change a prime exponent by one. Every point and edge is retained, including 3375 pitches in the largest panel. Twelve complete octave-folded pitch diagrams compare bases 10, 12, 30 and 210 across exponent windows from minus one to one, minus three to three, and minus seven to seven. Colored edges change a prime exponent by one. Every point and edge is retained, including 3375 pitches in the largest panel.
Read across to enlarge an exponent window. Read down to change the available primes. Every point is an exact rational interval folded into one octave, with unison at the top and pitch increasing clockwise. Lines change the exponent of 3, 5 or 7 by one. These are limiting tuning intervals, not finite deficit values. The largest window contains 3,375 pitches; none has been sampled out.
Three more views of the lattice

These plots cover the same ground as the figures above, one frame each for the bases, the comma, and the scale’s errors.

Earlier comparison of the intervals available from different bases.
Bases 10, 12 and 30 across one octave. Base 10 has the major third but not the fifth, base 12 has the fifth but not the third, and base 30 has all eight scale notes plus 25.
Earlier illustration of twelve fifths, seven octaves, and the Pythagorean comma.
Twelve pure fifths against seven octaves, with the 23.46-cent gap enlarged and the finite deficit ratio set beside the classical comma.
Earlier plot of the just major scale's finite relative errors.
The relative error of each note of the just major scale from starting points 24, 480 and 24,000, with the unison exact at every scale.
Further reading

The prime-based description of tuning has a long history. Euler’s work, Helmholtz’s On the Sensations of Tone, and Barbour’s Tuning and Temperament provide historical background. The following accounts develop the arithmetic used here.

  • Benson, Music: A Mathematical Offering, including the Pythagorean comma and temperaments.
  • Kurenniemi, Chords, Scales, and Divisor Lattices, including the prime-exponent lattice and the integer representation of the just major scale.
  • Archibald, Mathematics and Music (1924), an earlier survey of the subject.

The Alignment Deficit Lattice and Musical Tuning supplies a coordinate derived from long division on an established lattice. It is not a claim that the classical intervals or the major-scale integer sequence are new.

Companion paper: The Alignment Deficit Lattice and Musical Tuning →
Share

Discussion

Sign in to join the discussion.

← All articlesRead the paper →
← Previous: The Three-Tier Theorem
Next: The Coherence Decomposition →