Alex Petty

The Alignment Deficit Lattice and Musical Tuning

Repository PDFJournal articleZenodoOriginal reader and discussion
Cite this paper

A. S. Petty, The Alignment Deficit Lattice and Musical Tuning, DOI: 10.5281/zenodo.20404944.

Lean proofs

Abstract

For a prime p≥3p \ge 3 with b≡1(modp)b \equiv 1 \pmod p and an integer mm whose prime factors all divide bb, the repetend alignment αb(pm)=(2m−1)/(pm−1)\alpha_b(pm) = (2m-1)/(pm-1) approaches 2/p2/p with deficit δp(m)  =  p−2p(pm−1).\delta_p(m) \;=\; \frac{p-2}{p(pm-1)}. The exact deficit ratio between two such integers is δp(m1)δp(m2)=pm2−1pm1−1.\frac{\delta_p(m_1)}{\delta_p(m_2)} =\frac{pm_2-1}{pm_1-1}. Writing m1=tum_1 = tu, m2=tvm_2 = tv for fixed u,vu, v and scaling t→∞t \to \infty through PP-supported integers, the ratio converges to v/uv/u.

The integers supported on a fixed set of primes P={q prime:q∣b}P = \{q \text{ prime} : q \mid b\} form a free abelian monoid, and the deficit map is an injective, order-reversing numerical coordinate on this monoid. When PP coincides with the generators of a musical tuning system, the deficit ratios recover the intervals of that system asymptotically.

Representing just intervals by prime-exponent vectors is standard [3, 7]. To the author’s knowledge, the specific alignment-deficit coordinate described here has not been previously noted.

August 2026
2020 Mathematics Subject Classification: 11A63, 11B83

Introduction and the Alignment Formula

The arithmetic of repeating decimals encodes structure that depends on the prime factorization of the base. In the base-bb expansion of a rational number, factors shared with bb govern the terminating part, while the periodic part is governed by multiplication by bb modulo the remaining denominator. For primes pp with b≡1(modp)b \equiv 1\pmod p, the resulting one-digit repetends create a natural notion of alignment. This is the fraction of numerators kk whose base-bb expansion shares its repeating pattern with 1/n1/n.

This paper establishes an exact formula for the alignment of fractions k/(pm)k/(pm) when mm is supported on the prime factors of bb, and studies the resulting deficit from the limiting alignment 2/p2/p. The deficit has an exact ratio formula at every finite mm, and the ratio of deficits at two points m1m_1, m2m_2 converges to m2/m1m_2/m_1 as both scale to infinity. This makes the deficit a numerical coordinate on the monoid of bb-supported integers whose ratios recover the multiplicative structure of the monoid.

When the prime support of the base coincides with the generators of a musical tuning system, this convergence recovers the intervals of that system. The lattice {2e23e3:e2,e3∈Z}\{2^{e_2}3^{e_3}:e_2,e_3\in\mathbb{Z}\} underlying Pythagorean tuning arises from any base with prime support {2,3}\{2,3\}; adjoining the 55-axis gives the five-limit lattice, as in base 30=2⋅3⋅530=2\cdot3\cdot5. The Pythagorean comma and the just major scale are recovered as limits of exact deficit ratios, with relative errors below 10−310^{-3} even at the smallest scale.

We proceed as follows. The remainder of this section establishes the alignment formula and its setting. Section 2 develops the deficit map and its ratio properties. Sections 3 and 4 apply the theory to base 12 (Pythagorean tuning) and base 30 (five-limit just intonation), recovering the Pythagorean comma and the just major scale from the arithmetic of repeating decimals.

Definition 1. An integer m≥1m \ge 1 is PP-supported if every prime factor of mm belongs to P={q prime:q∣b}P = \{q \text{ prime} : q \mid b\}. Equivalently, mm divides some power of bb.

Remark 2. In standard number theory, “BB-smooth” means all prime factors are ≤B\le B. Our condition is different. We require all prime factors to divide bb, not merely to be bounded by bb. We use “PP-supported” to avoid confusion.

Definition 3. Use the standard base-bb expansion, with terminating expansions written with an eventual tail of zeros rather than an infinite tail of digits b−1b-1. For an integer n≥2n\ge2 and a base b≥2b \ge 2, the repetend alignment αb(n)\alpha_b(n) is the fraction of k∈{1,…,n−1}k \in \{1, \ldots, n-1\} for which the expansion of k/nk/n either terminates (counted as aligned by convention) or is identical, digit for digit, to the expansion of 1/n1/n at every sufficiently large common position.

Theorem 4 (Repetend alignment theorem). Let p≥3p \ge 3 be a prime with ordp(b)=1\mathop{\mathrm{ord}}_p(b) = 1 (equivalently, b≡1(modp)b \equiv 1 \pmod p), and let mm be PP-supported. Then αb(pm)  =  2m−1pm−1.\alpha_b(pm) \;=\; \frac{2m-1}{pm-1}.

Proof. Write b=hp+1b=hp+1, where h=(b−1)/ph=(b-1)/p. For each r∈{1,…,p−1}r\in\{1,\ldots,p-1\}, one step of base-bb long division gives br=(hr)p+r.br=(hr)p+r. Thus the quotient digit is dr=hrd_r=hr and the remainder is again rr. Since 0<dr<b0<d_r<b, this is a valid base-bb digit, and hence rp=0.dr‾b.\frac{r}{p}=0.\overline{d_r}_b. Distinct nonzero residues rr therefore give distinct one-digit repetends.

Choose LL so that m∣bLm\mid b^L, and put c=bL/mc=b^L/m. Shifting the base-bb point by LL places gives bLkpm=ckp.b^L\frac{k}{pm}=\frac{ck}{p}. Also p∤bp\nmid b. Both mm and cc divide powers of bb, so p∤mcp\nmid mc and cc is invertible modulo pp. The fractional part of ck/pck/p is (ck mod p)/p(ck\bmod p)/p. By the preceding long-division calculation, the eventual digit of k/(pm)k/(pm) is determined by ck mod pck\bmod p, while that of 1/(pm)1/(pm) is determined by c mod pc\bmod p. The two nonterminating tails agree digit for digit exactly when ck≡c(modp),ck\equiv c\pmod p, or, since cc is invertible, when k≡1(modp)k\equiv1\pmod p.

We can now count the pm−1pm-1 numerators 1≤k≤pm−11\le k\le pm-1.

  • Exactly m−1m-1 numerators, namely p,2p,…,(m−1)pp,2p,\ldots,(m-1)p, are nonzero multiples of pp. For these, k/(pm)k/(pm) reduces to a fraction whose denominator is PP-supported, so its base-bb expansion terminates. Conversely, if p∤kp\nmid k, the reduced denominator retains the factor pp and the expansion does not terminate.

  • Exactly mm numerators, namely 1,1+p,…,1+(m−1)p1,1+p,\ldots,1+(m-1)p, satisfy k≡1(modp)k\equiv1\pmod p. They are nonterminating and, by the preceding residue calculation, share the repeating block of 1/(pm)1/(pm).

  • The remaining (p−2)m(p-2)m fractions fall into p−2p-2 residue classes modulo pp, each with a one-digit repetend different from that of 1/(pm)1/(pm), so none of them are aligned.

The terminating and matching-repetend classes are disjoint. Hence (m−1)+m=2m−1(m-1)+m=2m-1 fractions are aligned out of pm−1pm-1, which gives the stated formula. ◻

Example. In base 1212, take p=11p=11 and m=2m=2, so pm=22pm=22. Among k=1,…,21k=1,\ldots,21, the numerator k=11k=11 gives the terminating fraction 11/22=1/211/22=1/2. The two numerators k=1,12k=1,12 satisfy k≡1(mod11)k\equiv1\pmod{11}, so their repetends match that of 1/221/22. Thus 1+2=31+2=3 numerators are aligned, in agreement with α12(22)=2⋅2−111⋅2−1=321.\alpha_{12}(22)=\frac{2\cdot2-1}{11\cdot2-1}=\frac{3}{21}.

The PP-supported integers form the free abelian monoid on PP. Writing P={q1,…,qs}P=\{q_1,\ldots,q_s\}, the exponent map m=∏i=1sqiei⟼(e1,…,es)m=\prod_{i=1}^s q_i^{e_i}\longmapsto(e_1,\ldots,e_s) identifies this monoid with N0s\mathbb{N}_0^s, the nonnegative orthant in the prime-exponent lattice Zs\mathbb{Z}^s. Its group completion represents PP-supported rational intervals [3, 7]. Allowing integer exponents, {2e23e3}\{2^{e_2}3^{e_3}\} parametrizes Pythagorean intervals, while {2e23e35e5}\{2^{e_2}3^{e_3}5^{e_5}\} parametrizes five-limit just intonation [3, 4].

This note observes that the alignment deficit provides a specific numerical coordinate on this monoid, arising from the digit function db(r)=⌊br/p⌋d_b(r) = \lfloor br/p \rfloor of long division, whose ratios recover the tuning intervals asymptotically.

The Deficit Map

Definition 5. Fix a base b≥2b\ge2, write P=Pb={q prime:q∣b}P=P_b=\{q\text{ prime}:q\mid b\}, and let p≥3p\ge3 be a prime divisor of b−1b-1. For a PbP_b-supported integer m≥1m\ge1, the alignment deficit is δb,p(m)  =  2p−αb(pm).\delta_{b,p}(m) \;=\; \frac{2}{p} - \alpha_b(pm). When the base is fixed, as it is in each application below, we abbreviate δb,p(m)\delta_{b,p}(m) to δp(m)\delta_p(m).

Remark 6. By direct computation, δp(m)=2(pm−1)−p(2m−1)p(pm−1)=p−2p(pm−1)\delta_p(m) = \frac{2(pm-1) - p(2m-1)}{p(pm-1)} = \frac{p - 2}{p(pm-1)}.

Theorem 7 (Deficit ratio theorem). For PP-supported integers m1,m2≥1m_1, m_2 \ge 1, δp(m1)δp(m2)  =  pm2−1pm1−1.\frac{\delta_p(m_1)}{\delta_p(m_2)} \;=\; \frac{pm_2 - 1}{pm_1 - 1}. The constant (p−2)(p-2) cancels. For fixed PP-supported u,vu,v, as tt tends to infinity through PP-supported positive integers, δp(tu)δp(tv)  =  ptv−1ptu−1  ⟶  vu.\frac{\delta_p(tu)}{\delta_p(tv)} \;=\; \frac{ptv - 1}{ptu - 1} \;\longrightarrow\; \frac{v}{u}.

Proof. The ratio is (pm2−1)/(pm1−1)(pm_2 - 1)/(pm_1 - 1) by direct computation. For the asymptotic, (ptv−1)/(ptu−1)=(v/u)⋅(1−1/(ptv))/(1−1/(ptu))→v/u(ptv - 1)/(ptu - 1) = (v/u) \cdot (1 - 1/(ptv))/(1 - 1/(ptu)) \to v/u as t→∞t \to \infty. ◻

Corollary 8 (Generator scaling). Fix a prime q∈Pq\in P. As mm tends to infinity through PP-supported positive integers, δp(m)δp(qm)=pqm−1pm−1=q+q−1pm−1  ⟶  q.\frac{\delta_p(m)}{\delta_p(qm)} =\frac{pqm-1}{pm-1} =q+\frac{q-1}{pm-1} \;\longrightarrow\; q.

The deficit map δp\delta_p is injective and order-reversing on the PP-supported integers (larger mm gives smaller deficit). It provides a numerical coordinate whose ratios asymptotically reproduce the multiplicative structure of the monoid.

Base 12 and the Pythagorean Comma

For base 12=22⋅312 = 2^2 \cdot 3, we have P={2,3}P = \{2, 3\}. The condition b≡1(modp)b \equiv 1 \pmod p gives p=11p = 11.

Pythagorean tuning is generated by the octave (2:12{:}1) and the perfect fifth (3:23{:}2) [2]. Its intervals are ratios of PP-supported integers in the group completion Z2\mathbb{Z}^2. The domain of the alignment-deficit coordinate is therefore the nonnegative cone in the same prime-exponent lattice.

Proposition 9 (Pythagorean comma). As tt tends to infinity through PP-supported positive integers, δ11(t⋅219)δ11(t⋅312)  ⟶  312219  ≈  1.01364(t→∞).\frac{\delta_{11}(t \cdot 2^{19})}{\delta_{11}(t \cdot 3^{12})} \;\longrightarrow\; \frac{3^{12}}{2^{19}} \;\approx\; 1.01364 \quad (t \to \infty). The limit is the Pythagorean comma. At t=1t = 1, the ratio is 1.0136431.013643, matching the comma to six significant figures.

Proof. Apply Theorem 7 with m1=t⋅219m_1=t\cdot2^{19} and m2=t⋅312m_2=t\cdot3^{12}. This gives δ11(t⋅219)/δ11(t⋅312)→312/219\delta_{11}(t \cdot 2^{19})/\delta_{11}(t \cdot 3^{12}) \to 3^{12}/2^{19}. At t=1t = 1, the exact value is (11⋅312−1)/(11⋅219−1)=5845850/5767167≈1.013643(11 \cdot 3^{12} - 1)/(11 \cdot 2^{19} - 1) = 5845850/5767167 \approx 1.013643. ◻

Remark 10 (Base dependence). The prime-exponent domain and the limiting interval ratios depend only on PP. The finite deficit values and their approximation errors also depend on the chosen alignment prime pp. Any base with P={2,3}P=\{2,3\}, such as 66, 1212, or 2424, has the Pythagorean prime-exponent domain. For base 10=2⋅510=2\cdot5, the prime 33 is absent, so the domain contains octaves and major thirds (5/45/4) but not fifths (3/23/2). The Pythagorean comma requires both 22 and 33 and cannot appear.

Base 30 and the Just Major Scale

For base 30=2⋅3⋅530 = 2 \cdot 3 \cdot 5, we have P={2,3,5}P = \{2, 3, 5\} and p=29p = 29. The PP-supported monoid shares its generators with five-limit just intonation [3, 4].

The just major scale uses the interval ratios 11, 9/89/8, 5/45/4, 4/34/3, 3/23/2, 5/35/3, 15/815/8, 22, a classical set [2, 5].

Proposition 11 (Diatonic lattice). Let m0=24=23⋅3m_0 = 24 = 2^3 \cdot 3. The eight PP-supported integers 24,  27,  30,  32,  36,  40,  45,  4824,\; 27,\; 30,\; 32,\; 36,\; 40,\; 45,\; 48 have ratios to m0m_0 equal to the just major scale intervals. As the PP-supported scaling factor tt tends to infinity, δ29(t⋅24)δ29(t⋅m)  ⟶  m24(t→∞)\frac{\delta_{29}(t \cdot 24)}{\delta_{29}(t \cdot m)} \;\longrightarrow\; \frac{m}{24} \quad (t \to \infty) for each mm in the list. At t=1t = 1 the relative errors are below 7.2×10−47.2 \times 10^{-4}.

Proof. Each integer is PP-supported, as shown by its factorization. 24=23⋅324 = 2^3 \cdot 3, 27=3327 = 3^3, 30=2⋅3⋅530 = 2 \cdot 3 \cdot 5, 32=2532 = 2^5, 36=22⋅3236 = 2^2 \cdot 3^2, 40=23⋅540 = 2^3 \cdot 5, 45=32⋅545 = 3^2 \cdot 5, 48=24⋅348 = 2^4 \cdot 3. The ratios to m0=24m_0 = 24 are 2724=98,3024=54,3224=43,3624=32,4024=53,4524=158,4824=2.\begin{gathered} \frac{27}{24} = \frac{9}{8},\quad \frac{30}{24} = \frac{5}{4},\quad \frac{32}{24} = \frac{4}{3},\quad \frac{36}{24} = \frac{3}{2},\\ \frac{40}{24} = \frac{5}{3},\quad \frac{45}{24} = \frac{15}{8},\quad \frac{48}{24} = 2. \end{gathered} These are the classical just major scale intervals. By Theorem 7 with m1=t⋅24m_1 = t \cdot 24 and m2=t⋅mm_2 = t \cdot m, δ29(t⋅24)δ29(t⋅m)=29 tm−129⋅24 t−1=m24⋅1−1/(29 tm)1−1/(696 t)⟶m24(t→∞).\frac{\delta_{29}(t \cdot 24)}{\delta_{29}(t \cdot m)} = \frac{29\,tm - 1}{29 \cdot 24\,t - 1} = \frac{m}{24}\cdot \frac{1 - 1/(29\,tm)}{1 - 1/(696\,t)} \longrightarrow \frac{m}{24} \quad(t \to \infty). At t=1t=1, the relative error at the scale point mm is exactly (29m−1)/(29⋅24−1)m/24−1=m−24695m.\frac{(29m-1)/(29\cdot24-1)}{m/24}-1 =\frac{m-24}{695m}. This expression increases with mm on the listed range. Its maximum occurs at m=48m=48 and equals 24/(695⋅48)=1/1390<7.2×10−424/(695\cdot48)=1/1390<7.2\times10^{-4}. ◻

Remark 12. The choice m0=24m_0 = 24 is the least common denominator of the just major scale ratios. The resulting integers are PP-supported because the scale ratios involve only the primes 22, 33, 55. Any base with prime support containing {2,3,5}\{2, 3, 5\} produces a PP-supported lattice that contains the same five-limit sublattice (a base with prime support {2,3,5,7}\{2, 3, 5, 7\} gives a larger lattice).

The PP-supported integers in [24,48][24, 48] also include 25=5225 = 5^2, giving the ratio 25/2425/24 (just chromatic semitone). The diatonic scale is a subset of the full lattice within this octave, not the complete set.

The successive step ratios between diatonic notes are 9/89/8, 10/910/9, 16/1516/15, 9/89/8, 10/910/9, 9/89/8, and 16/1516/15. This is the classical whole-tone/semitone pattern [3].

Remark 13 (A seven-limit extension). Seven-limit just intonation uses the prime set {2,3,5,7}\{2,3,5,7\} and includes the harmonic seventh 7/47/4 and the septimal whole tone 8/78/7 [3]. For b=210b=210, Pb={2,3,5,7}P_b=\{2,3,5,7\} and 11∣210−111\mid210-1, so Theorem 7 applies with p=11p=11. As tt tends to infinity through PbP_b-supported positive integers, δ210,11(4t)δ210,11(7t)=77t−144t−1⟶74,δ210,11(7t)δ210,11(8t)=88t−177t−1⟶87.\frac{\delta_{210,11}(4t)}{\delta_{210,11}(7t)} =\frac{77t-1}{44t-1}\longrightarrow\frac74, \qquad \frac{\delta_{210,11}(7t)}{\delta_{210,11}(8t)} =\frac{88t-1}{77t-1}\longrightarrow\frac87.

Remark 14. At m0=480m_0=480, a common five-limit just chromatic scale [2] (with ratios 11, 16/1516/15, 9/89/8, 6/56/5, 5/45/4, 4/34/3, 45/3245/32, 3/23/2, 8/58/5, 5/35/3, 9/59/5, 15/815/8, 22) produces thirteen PP-supported integers. The deficit ratios have relative errors below 3.6×10−53.6\times10^{-5}. Indeed, the same calculation as above gives the maximum at m=960m=960, where the relative error is 1/27838<3.6×10−51/27838<3.6\times10^{-5}.

Remarks

Relation to normal numbers

Borel’s notion of normality and repetend alignment both concern digit blocks in a fixed base, but they quantify different objects. A real number is normal to base bb if every kk-digit block has limiting frequency b−kb^{-k} in its canonical infinite digit expansion [1]. The canonical base-bb expansion of a rational number is eventually periodic and therefore non-normal. Indeed, if its periodic tail has period LL, then for any kk with bk>Lb^k>L, at most LL of the bkb^k possible kk-blocks can have positive limiting frequency.

By contrast, αb(pm)\alpha_b(pm) counts, across the finite family k/(pm)k/(pm), the expansions that terminate or share the specified periodic tail of 1/(pm)1/(pm). Thus δp(m)\delta_p(m) measures the difference between this finite-family proportion and 2/p2/p, not a distance from normality.

Novelty and scope

The prime-exponent representation of just intonation is standard [3, 7], and the relation between smooth numbers and musical intervals has been discussed in the literature [6, 7]. To the author’s knowledge, the specific alignment-deficit coordinate described here has not been previously noted. The musical content and the limiting ratios depend on the prime support of the base; the finite coordinate values also depend on the alignment prime. Many functions f(m)∼C/mf(m) \sim C/m on the PP-supported monoid share this asymptotic behavior. The contribution here is that the arithmetic of repeating decimals produces such a function naturally, with an elementary derivation and an exact (not merely asymptotic) ratio formula at every finite mm.

References

[1]É. Borel, Les probabilités dénombrables et leurs applications arithmétiques, Rend. Circ. Mat. Palermo 27 (1909), 247–271. doi:10.1007/BF03019651.

[2]J. M. Barbour, Tuning and Temperament: A Historical Survey, Michigan State College Press, 1951. Reprinted by Dover, 2004.

[3]D. J. Benson, Music: A Mathematical Offering, Cambridge University Press, 2007.

[4]H. von Helmholtz, On the Sensations of Tone as a Physiological Basis for the Theory of Music, 2nd English ed., translated by A. J. Ellis, Longmans, Green, 1885; reprinted by Dover, 1954.

[5]R. C. Archibald, Mathematicians and music, Amer. Math. Monthly 31 (1924), 1–25.

[6]F. D. Jevtić, Smooth numbers in music and architecture, in V. Todorčević (ed.), A Hidden Harmony: Mathematics and Music Through the Ages, Zbornik radova / Matematički institut SANU, 29(21) (2024), 69–74. doi:10.18485/mi_sanu_zr.2024.29.21.ch4.

[7]E. Kurenniemi, Chords, scales, and divisor lattices (2003), in J. Krysa and J. Parikka (eds.), Writing and Unwriting (Media) Art History: Erkki Kurenniemi in 2048, MIT Press, 2015, 233–254. doi:10.7551/mitpress/10014.003.0026.