Primes and the Major Scale

The primes that organize long division are the same primes that organize musical pitch. In base 30, the alignment deficit lattice produces the just major scale. In base 12, the Pythagorean comma.

Primes and the Major Scale
Two lattices. On the left, base 12: the generators are 2 and 3, twelve fifths and seven octaves almost meet, and the gap between them is the Pythagorean comma. On the right, base 30: eight gold points form the just major scale.

There is a loose thread running through the history of mathematics and music. The primes 2, 3, and 5 generate the intervals of the Western scale. The octave is 2. The fifth is 3/2. The major third is 5/4. Pythagoras knew the first two. The third took two thousand years. Ramos de Pareja proposed the just major third (5/4) in 1482, replacing the harsh Pythagorean 81/64. Zarlino codified it in 1558. The prime-axis lattice description of these intervals is classical. Archibald published the integer sequence 24:27:30:32:36:40:45:48 as the just major scale in the American Mathematical Monthly in 1924. But the specific route through the alignment deficit of repeating decimals has not, to my knowledge, been observed until now.

After proving the three-tier theorem, I kept looking at the Tier 2 values. Not at the values themselves but at the gaps between them and their limit.

The Tier 2 alignment approaches 2/3 but never reaches it. The deficit, the distance still to go, is

$$\delta(m) = \frac{2}{3} - \alpha(3m) = \frac{1}{3(3m-1)}$$

(In general, for prime p, the deficit is (p-2)/(p(pm-1)). For p = 3, p-2 = 1.)

I lined up the deficits for the pure powers of 2.

m n = 3m deficit
4 12 1/33
8 24 1/69
16 48 1/141
32 96 1/285
64 192 1/573

Each step doubles m and approximately halves the deficit. Not exactly, but the ratio converges to 2 as m grows. Doubling the smooth factor halves the remaining distance to the limit.

That is octave structure. In music, each octave doubles the frequency. Here, each doubling of the smooth factor halves the deficit. The same operation, the same ratio, on a different object.

The 10-smooth numbers live on a two-dimensional lattice. One axis is the prime 2. The other is the prime 5. Moving along the 2-axis halves the deficit (octaves). Moving along the 5-axis divides by 5. But there is no axis for the prime 3. The fifth is missing.

In music, the fifth is the interval 3/2. To get it, you need the prime 3 as a generator. In base 10, the prime 3 governs the Tier 2 conductor (n = 3m), but it does not appear in the smooth lattice. The two roles are structurally distinct. That is why the base-10 deficit lattice carries octaves and thirds but not fifths.

Base 12

Base 12 has smooth generators 2 and 3.

I switched bases and recomputed. In base 12, the smooth integers are products of 2 and 3. The deficit lattice has two axes. One for 2. One for 3. Doubling m halves the deficit. Tripling m thirds the deficit.

Those are the generators of Pythagorean tuning. The octave (ratio 2) and the twelfth (ratio 3, which is an octave plus a fifth). Every Pythagorean interval is a ratio of products of 2 and 3.

The deficit ratio between two lattice points converges to the ratio of their m values as both grow. So every Pythagorean interval appears asymptotically in the deficit lattice. The fifth (3/2) appears as the deficit ratio when you triple m and halve it. The fourth (4/3) appears as two doublings and one halving by 3.

Then I checked the Pythagorean comma.

The comma

The Pythagorean comma is the oldest known tuning problem. Twelve perfect fifths should equal seven octaves, but they do not. The discrepancy is

$$\frac{3^{12}}{2^{19}} = \frac{531441}{524288} \approx 1.01364$$

This small ratio, about a quarter of a semitone, is the reason Pythagorean tuning cannot close. It is the reason equal temperament exists. It has been known since at least the sixth century BC.

These are the canonical lattice points for the comma: 531441 is twelve fifths, 524288 is seven octaves. I computed the deficit at both. The ratio is 1.013643.

The Pythagorean comma. Matching to six significant figures at finite m. Exact in the limit.

The perfect fifth in the deficit lattice

The alignment formula reproduces the comma because the deficit ratio converges to the ratio of the lattice points, and 531441/524288 IS the comma. The digit function inherits the same incommensurability between octaves and fifths that has governed musical tuning for two and a half thousand years.

The principle

The deficit ratio depends on the prime support of the base, not the base itself. Any base whose prime factors are 2 and 3 (base 6, 12, 24, ...) produces the same Pythagorean lattice. Any base whose prime factors include 2, 3, and 5 (base 30, 60, 120, ...) produces the same five-limit lattice. The base picks the specific prime p and the rate of convergence. The lattice structure comes from the prime support alone.

The prime-axis description of tuning intervals is classical. It goes back at least to Euler and is standard in the modern theory of just intonation. What I had not seen before is the specific route through the alignment deficit of repeating decimals.

Base 30 and the major scale

Base 30 = 2 × 3 × 5. The smooth generators are exactly the three primes of five-limit just intonation. The deficit lattice is three-dimensional.

Here is how the scale appears. Start at m₀ = 24 = 2³ × 3. The other lattice points reachable within one octave by multiplying by ratios of 2, 3, and 5 include 27, 30, 32, 36, 40, 45, and 48. Their ratios to 24 are 9/8, 5/4, 4/3, 3/2, 5/3, 15/8, and 2. Those are the just major scale intervals.

The choice m₀ = 24 is the least common denominator of these ratios. The fact that the resulting integers are all products of 2, 3, and 5 is not a coincidence. The scale ratios involve only those primes. The lattice within [24, 48] also contains 25 = 5², giving 25/24, the just chromatic semitone. The diatonic scale is a subset of the full lattice within this octave, not the complete set.

I computed the deficit ratios at p = 29 (since 30 ≡ 1 mod 29). Two columns matter. The "m/m₀" column is the ratio of the lattice point to the starting point, determined entirely by the factorization of m. The "deficit ratio" column is computed from the alignment formula. They agree because the deficit map is asymptotically faithful to the lattice.

Note m m/m₀ Deficit ratio
Do 24 1 1.000
Re 27 9/8 1.125
Mi 30 5/4 1.250
Fa 32 4/3 1.334
Sol 36 3/2 1.501
La 40 5/3 1.668
Ti 45 15/8 1.876
Do 48 2 2.001

The m/m₀ ratios are the just intonation intervals, produced by the lattice arithmetic. 9/8 appears because 27/24 = 9/8. 3/2 appears because 36/24 = 3/2. The intervals are consequences of the lattice, not inputs to it.

The deficit ratios match the just intervals to three decimal places at m₀ = 24, and the error shrinks as m grows. At m₀ = 240,000, the fifth is accurate to eight decimal places. The scale is exact in the limit.

Eight notes, three starting points

The step pattern between consecutive notes: 9/8, 10/9, 16/15, 9/8, 10/9, 9/8, 16/15. Whole tone, whole tone, semitone, whole tone, whole tone, whole tone, semitone. That is the major scale.

Do re mi fa sol la ti do. From the alignment deficit of long division in base 30.

The lattice structure of just intonation is classical. What is new here is the specific route: through the digit function, through the alignment formula, through the deficit. A road nobody took to a place that was already on the map.


A note from 2026

April 2026

I have been a musician for most of my life, and I had been looking for this connection for almost as long. The golden ratio appears constantly in discussions of musical proportion, in the spiral of the cochlea, in the overtone series, in the layout of the piano keyboard. The claims range from rigorous to mystical, and sorting one from the other has been a persistent frustration. Most of the claimed connections dissolve on contact with the mathematics. The golden ratio is not the frequency ratio of any interval in any standard tuning system. The Fibonacci sequence approximates the semitone layout but does not generate it. The popular accounts do not produce the scale.

The alignment deficit does produce the scale. The mechanism is the asymptotic multiplicativity of the deficit on the smooth-integer lattice. The primes 2, 3, and 5 generate the lattice and the tuning system simultaneously. The connection runs through the arithmetic of repeating decimals.

The paper uses the precise term "P-supported" for integers whose prime factors divide the base, to distinguish from the standard number-theoretic use of "smooth." The blog uses "smooth" informally throughout.

The deficit lattice grew out of the alignment series, where the golden threshold first selected the prime 3. It turns out to be a projection of something richer. The Collision Periodic Table assigns signed integer values to every coprime residue class, and at base 12 those values sort the four intervals coprime to the octave into an ordering that tracks musical tension. The leading tone carries the only positive weight. The fifth is nearly neutral. The unison is the most negative. That ordering is a result about the collision table, not the deficit lattice, but it comes from the same digit function.

.:.


Try it yourself

See the major scale emerge from the deficit lattice. Eight notes, do to do, the full octave:

$ ./nfield scale

Just Major Scale (8 tones) (base 30, p = 29, m0 = 24)

  Note       m/m0           m  smooth     def.ratio     lattice       error
  -------- ------  ----------  ------  ------------  ----------  ----------
  Do  (C)   1/1            24   yes        1.000000    1.000000    0.00e+00
  Re  (D)   9/8            27   yes        1.125180    1.125000    1.60e-04
  Mi  (E)   5/4            30   yes        1.250360    1.250000    2.88e-04
  Fa  (F)   4/3            32   yes        1.333813    1.333333    3.60e-04
  Sol (G)   3/2            36   yes        1.500719    1.500000    4.80e-04
  La  (A)   5/3            40   yes        1.667626    1.666667    5.76e-04
  Ti  (B)  15/8            45   yes        1.876259    1.875000    6.71e-04
  Do  (C)   2/1            48   yes        2.001439    2.000000    7.19e-04

Convergence (perfect fifth, ratio 3/2):

          m0     deficit ratio       error
          24      1.5007194245    4.80e-04
         240      1.5000718494    4.79e-05
        2400      1.5000071840    4.79e-06
       24000      1.5000007184    4.79e-07
      240000      1.5000000718    4.79e-08
     2400000      1.5000000072    4.79e-09

  Exact in the limit.

Read the columns. The "m/m0" column is the ratio of the lattice point to the starting point, determined by the arithmetic alone. The "def.ratio" column is what the alignment formula computes from the deficit. The "error" column shows how close they are at this finite m.

Look at Sol. The lattice point is m = 36. The ratio 36/24 = 3/2, the perfect fifth. The deficit ratio is 1.500719. Nobody asked for a fifth. The lattice produced it because 36 is the next smooth integer you reach by multiplying 24 by 3/2. The convergence table shows what happens as m grows. At m = 2,400,000 the ratio is accurate to nine decimal places.

Now all twelve tones, every sharp and flat between do and do:

$ ./nfield scale --chromatic

Just Chromatic Scale (12 tones) (base 30, p = 29, m0 = 480)

  Note       m/m0           m  smooth     def.ratio     lattice       error
  -------- ------  ----------  ------  ------------  ----------  ----------
  C         1/1           480   yes        1.000000    1.000000    0.00e+00
  C#       16/15          512   yes        1.066671    1.066667    4.49e-06
  D         9/8           540   yes        1.125009    1.125000    7.98e-06
  Eb        6/5           576   yes        1.200014    1.200000    1.20e-05
  E         5/4           600   yes        1.250018    1.250000    1.44e-05
  F         4/3           640   yes        1.333357    1.333333    1.80e-05
  F#       45/32          675   yes        1.406279    1.406250    2.08e-05
  G         3/2           720   yes        1.500036    1.500000    2.39e-05
  Ab        8/5           768   yes        1.600043    1.600000    2.69e-05
  A         5/3           800   yes        1.666715    1.666667    2.87e-05
  Bb        9/5           864   yes        1.800057    1.800000    3.19e-05
  B        15/8           900   yes        1.875063    1.875000    3.35e-05
  C         2/1           960   yes        2.000072    2.000000    3.59e-05

Twelve tones, all smooth, all converging. The chromatic scale starts at m = 480 instead of 24 because F-sharp (45/32) needs a denominator divisible by 32. The errors are smaller here because the lattice points are larger.

Code: github.com/alexspetty/nfield
Paper: The Alignment Deficit Lattice


Alexander S. Petty
October 2020 (updated April 2026)
.:.