Petty’s Notebook

The Cubic Law for Digit-Collision Energy

About this paperRepository PDFZenodo
Cite this paper

A. S. Petty, The Cubic Law for Digit-Collision Energy, DOI: 10.5281/zenodo.20547910.

Lean proofs

Abstract

For an odd prime base bb, the complete lag-one carry table compares the two digits of a remainder word over every unit multiplier modulo b2b^2. After its residue-class means are removed, let EbE_b be the resulting centered square mass. We prove Eb=b3+O ⁣(b2(log⁡b)2),E_b=b^3+O\!\left(b^2(\log b)^2\right), with diagonal and off-diagonal leading terms 13b3\tfrac13 b^3 and 23b3\tfrac23 b^3. Thus the cubic mass divides in the proportion 1:21:2.

The observable belongs to Hamming correlation, and its continuous leading scale has a classical GCD and LCM sum analogue. The result here concerns its complete prime-square realization without a primitive-root hypothesis. An exact dictionary identifies EbE_b as a threshold-crossing variance, a Bernoulli-weighted primitive-character square mass, and a weighted average of classical Dedekind sums. Removing the weight gives a double sum over collision ratios. Rademacher reciprocity exposes the exact diagonal and coprime off-diagonal contributions, while oddness and a first absolute moment control the remainders. The character form also gives an exact weighted L(1)L(1) moment. The secondary coefficient is not claimed here.

June 2026 (revised September 11, 2026)
2020 Mathematics Subject Classification: Primary 11A63; Secondary 11L05, 11L26, 11L40, 11M20

Digit Boundaries and Collision Energy

In base 33, the six unit residues modulo 99 have centered collision energy 16/316/3. As the odd prime base bb grows, the corresponding finite square mass grows on the cubic scale. Equal collision ratios carry one third of the leading term. Unequal coprime ratios carry the other two thirds. The 1:21:2 proportion concerns the leading coefficients as the prime base grows; the finite diagonal and off-diagonal masses have separate error terms.

A lag-one digit collision asks whether the leading and trailing digits of a two-digit remainder word agree. Centering its carry table within each residue class modulo bb removes the deterministic class means and leaves a square mass EbE_b. The size of EbE_b measures the fluctuation carried by the finite digit boundary.

The same finite object has additive and multiplicative readings. Intervals and carries produce the table. Residue classes, characters, and Dedekind sums expose its spectrum. The proof moves between these readings without changing the object.

The collision statistic asks when the leading base-bb digit bins of two scaled remainders collide. After a finite slice decomposition, that condition becomes membership in the diagonal Gℓ,b={ 0≤n<bℓ+1 : ⌊n/bℓ⌋≡n(modb) },G_{\ell,b}=\bigl\{\,0\le n<b^{\ell+1}\ :\ \lfloor n/b^{\ell}\rfloor\equiv n\pmod b\,\bigr\}, the set of (ℓ+1)(\ell+1)-digit words whose leading digit equals the trailing digit. The boundary of this diagonal is the finite source of the spectral coefficients.

Agreement between a finite sequence and its cyclic shifts belongs to classical Hamming-correlation theory [14]. Kak and Chatterjee studied prime-reciprocal digit sequences as communication codes and obtained bounds for their Hamming distance from cyclic shifts and for their autocorrelation [13]. The collision diagonal uses that same coordinate-agreement observable. It is not introduced here. The present problem instead asks for the total centered energy of the complete unit table modulo b2b^2, without assuming that a chosen base generates a full reciprocal orbit.

A neighboring number-theoretic literature studies the values of digits along multiplicative reciprocal orbits. Girstmair connected those values with class-number factors and expressed digit variance through Dedekind sums [8, 9, 10]. Murty and Thangadurai treated bases of prescribed order through generalized Bernoulli numbers and Dirichlet LL-values [17]. Those orbitwise digit-value statistics are distinct from the equality indicator and complete multiplier ensemble used here, but they establish the surrounding arithmetic setting.

The leading mass also has a classical continuous analogue. Hilberdink, Luca, and Tóth [11] prove that ∑r,s≤N(r,s)2rs=3N+O((log⁡N)2).\sum_{r,s\le N}\frac{(r,s)^2}{rs}=3N+O((\log N)^2). This sum is three times the continuous square mass of 2∑r≤N((rx))2\sum_{r\le N}((rx)). Its leading scale is therefore already known. The finite prime-square table requires the exact carry, character, and Dedekind identities developed below.

The contribution proved here is the exact phase reduction of the boundary flux to a short character sum, the identification of the same finite energy as a carry-table variance and collision-weighted Dedekind average, and the weight-free reduced-ratio decomposition. Rademacher reciprocity then gives the cubic law while retaining the exact diagonal and proves the 1:21:2 leading split. The theorem concerns this specified finite ensemble and its normalization.

The main theorem is the cubic law for digit-collision energy. For odd primes bb, with the lag-one energy EbE_b defined by the threshold carry table in Section 3, Eb=b3+O ⁣(b2(log⁡b)2),E_b=b^3+O\!\left(b^2(\log b)^2\right), and the leading term splits as a diagonal contribution 13b3\tfrac13 b^3 and an off-diagonal contribution 23b3\tfrac23 b^3. The argument proves this statement from the finite table definitions.

The Dedekind average places the collision table inside a classical theory. Reciprocity is presented by Rademacher and Grosswald [19] and by Apostol [1]. Mean values and moments were studied by Conrey, Fransen, Klein, and Scott [5]. Bettin and Conrey connect related cotangent sums with period functions [3]. Restricted averages and subgroup correlations are studied in [16, 4]. The geometry below instead fixes the modulus b2b^2 and restricts both ratio coordinates to the first digit window.

The multiplicative form uses generalized Bernoulli numbers, Dirichlet characters, and Dirichlet LL-functions. Standard references include Davenport [6], Washington [20], and Iwaniec and Kowalski [12]. The character summation formulas used here are due to Berndt [2]. Mean squares of L(1,χ)L(1,\chi) over character families and subgroups, together with their Dedekind-sum expressions, are also established subjects [15]. The moment below has the specific short-window weight forced by the collision table.

The Collision Spectrum

The collision spectrum is the character transform of the digit boundary. The diagonal gives the finite setting. The asymptotic proof begins with the lag-one carry table.

Collision diagonal

Fix b≥2b\ge 2, ℓ≥1\ell\ge 1, and m=bℓ+1m=b^{\ell+1}. For a residue n mod mn\bmod m, write its (ℓ+1)(\ell+1)-digit base-bb expansion with leading zeros allowed. The lag-ℓ\ell collision condition compares the leading and trailing digits of this word, and therefore forces the finite diagonal Gℓ,b={ 0≤n<m : ⌊n/bℓ⌋≡n(modb) }.G_{\ell,b}=\bigl\{\,0\le n<m\ :\ \lfloor n/b^{\ell}\rfloor\equiv n\pmod b\,\bigr\}.

Remark 1 (Finite collision diagonal). The integer nn records the residue of the relevant scaled remainder modulo mm. Writing n=dℓbℓ+⋯+d1b+d0,0≤di<b,n=d_\ell b^\ell+\cdots+d_1b+d_0,\qquad 0\le d_i<b, the leading digit is dℓ=⌊n/bℓ⌋d_\ell=\lfloor n/b^\ell\rfloor, while the trailing digit is d0≡n(modb)d_0\equiv n\pmod b. Same-bin membership is therefore the equality dℓ=d0d_\ell=d_0, which is exactly the displayed congruence defining Gℓ,bG_{\ell,b}. This ambient diagonal language motivates the lag-one prime-base table below; the cubic theorem itself begins from the explicit threshold table of Section 3.

Primitive odd factorization

For a Dirichlet character χ\chi modulo qq, write B1,χ(q)=1q∑a=1q−1χ(a)a.B_{1,\chi}^{(q)}=\frac1q\sum_{a=1}^{q-1}\chi(a)a. When the modulus is fixed by context, write B1,χB_{1,\chi}. We use the standard sawtooth notation ((x))={x}−12((x))=\{x\}-\frac12 for nonintegral xx, with ((x))=0((x))=0 for integral xx.

The Fourier convention is f^(χ)=1φ(m)∑x∈(Z/mZ)×f(x)χ(x)‾.\widehat f(\chi)=\frac1{\varphi(m)} \sum_{x\in(\mathbb{Z}/m\mathbb{Z})^\times}f(x)\overline{\chi(x)}.

Lemma 2 (Odd sawtooth expansion). Let q≥2q\ge2. For (a,q)=1(a,q)=1, ( ⁣(aq) ⁣)=1φ(q)∑χmodqχ(−1)=−1B1,χ‾ χ(a).\Bigl(\!\Bigl(\frac aq\Bigr)\!\Bigr) =\frac1{\varphi(q)} \sum_{\substack{\chi\bmod q\\\chi(-1)=-1}}B_{1,\overline\chi}\,\chi(a).

Proof. On the finite group (Z/qZ)×(\mathbb{Z}/q\mathbb{Z})^\times, expand ((a/q))=∑χλχχ(a)((a/q))=\sum_\chi \lambda_\chi\chi(a). Orthogonality gives λχ=1φ(q)∑(a,q)=1( ⁣(aq) ⁣)χ(a)‾.\lambda_\chi=\frac1{\varphi(q)} \sum_{(a,q)=1}\Bigl(\!\Bigl(\frac aq\Bigr)\!\Bigr)\overline{\chi(a)}. For nonprincipal χ\chi, the constant part of ((a/q))=a/q−12((a/q))=a/q-\tfrac12 sums to zero, so ∑(a,q)=1( ⁣(aq) ⁣)χ(a)‾=1q∑a=1q−1χ‾(a)a=B1,χ‾.\sum_{(a,q)=1}\Bigl(\!\Bigl(\frac aq\Bigr)\!\Bigr)\overline{\chi(a)} =\frac1q\sum_{a=1}^{q-1}\overline\chi(a)a =B_{1,\overline\chi}. The sawtooth is odd, so only odd characters survive. The principal character is even and contributes nothing. This is the character-analogue Euler–Maclaurin expansion of [2]. ◻

For lag one in prime base, the centered collision function is defined directly from the carry table in Definition 8, and Theorem 10 proves the exact primitive odd factorization. The conjugate Bernoulli index B1,χ‾B_{1,\overline\chi} appears in the coefficient with the Fourier convention above; square masses are unchanged because B1,χ‾=B1,χ‾B_{1,\overline\chi}=\overline{B_{1,\chi}}.

For the lag-one diagonal G=G1,b={r(b+1):0≤r≤b−1}G=G_{1,b}=\{r(b+1):0\le r\le b-1\}, write SG(χ)=∑r=0b−1(χ(r(b+1)+1)−χ(r(b+1))).S_G(\chi)= \sum_{r=0}^{b-1}\bigl(\chi(r(b+1)+1)-\chi(r(b+1))\bigr).

Imprimitive odd sector

For the prime-square lag-one theorem, the imprimitive odd sector has an exact vanishing statement.

Proposition 3 (Prime-square imprimitive vanishing). Let bb be an odd prime, and let χ mod b2\chi\bmod b^2 be odd and induced from a character modulo bb. Then Sχ:=∑k=1b−1χ(k)=0.S_\chi:=\sum_{k=1}^{b-1}\chi(k)=0. Consequently, the lag-one boundary flux also vanishes. SG(χ)=0.S_G(\chi)=0 .

Proof. The values 1,…,b−11,\ldots,b-1 form the complete reduced residue system modulo bb, so Sχ=0S_\chi=0 by character orthogonality for the nonprincipal character inducing χ\chi. Since χ\chi is odd, Lemma 5 gives SG(χ)=−2χ(b+1)Sχ=0.S_G(\chi)=-2\chi(b+1)S_\chi=0. ◻

Parseval mass layer

The energy of any explicitly centered collision function is its finite Parseval square mass. The prime-square lag-one specialization is carried out from the table definitions in Definition 8 through Corollary 12.

Lemma 4 (Parseval mass formula). Put U=(Z/mZ)×U=(\mathbb{Z}/m\mathbb{Z})^\times. For every function S∘ ⁣:U→CS^\circ\colon U\to\mathbb C, the Fourier convention above gives ∑x∈U∣S∘(x)∣2=φ(m)∑χ mod m∣S∘^(χ)∣2.\sum_{x\in U}|S^\circ(x)|^2 = \varphi(m)\sum_{\chi\bmod m}|\widehat{S^\circ}(\chi)|^2 .

Proof. Fourier inversion on UU gives S∘(x)=∑χ mod mS∘^(χ)χ(x),S∘^(χ)=1φ(m)∑x∈US∘(x)χ(x)‾.S^{\circ}(x)=\sum_{\chi\bmod m}\widehat{S^{\circ}}(\chi)\chi(x), \qquad \widehat{S^{\circ}}(\chi)=\frac1{\varphi(m)} \sum_{x\in U}S^{\circ}(x)\overline{\chi(x)} . Orthogonality on UU gives the square-mass identity ∑x∈U∣S∘(x)∣2=φ(m)∑χ mod m∣S∘^(χ)∣2.\sum_{x\in U}|S^{\circ}(x)|^2 =\varphi(m)\sum_{\chi\bmod m}|\widehat{S^{\circ}}(\chi)|^2 . ◻

Lemma 5 (Lag-one boundary reduction). Let m=b2m=b^2, G=G1,b={r(b+1):0≤r≤b−1}G=G_{1,b}=\{r(b+1):0\le r\le b-1\}, and extend Dirichlet characters by zero on nonunits. For every odd character χ mod b2\chi\bmod b^2, SG(χ)=−2 χ(b+1)∑k=1b−1χ(k).S_G(\chi) =-2\,\chi(b+1)\sum_{k=1}^{b-1}\chi(k). Consequently, if Sχ=∑k=1b−1χ(k)S_\chi=\sum_{k=1}^{b-1}\chi(k), then ∣SG(χ)∣2=4∣Sχ∣2.|S_G(\chi)|^2=4|S_\chi|^2.

Proof. Write SG(χ)=Q−αP,α=χ(b+1),P=∑k=1b−1χ(k),S_G(\chi)=Q-\alpha P,\qquad \alpha=\chi(b+1),\qquad P=\sum_{k=1}^{b-1}\chi(k), where Q=∑r=0b−2χ(r(b+1)+1).Q=\sum_{r=0}^{b-2}\chi(r(b+1)+1). The nn-terms give αP\alpha P, because χ(r(b+1))=χ(b+1)χ(r)\chi(r(b+1))=\chi(b+1)\chi(r), with both sides zero when rr is not a unit. The n+1n+1-term at r=b−1r=b-1 is χ(b2)=0\chi(b^2)=0, which is why QQ stops at b−2b-2.

The reflection b2−(r(b+1)+1)=(b−1−r)(b+1)b^2-\bigl(r(b+1)+1\bigr)=(b-1-r)(b+1) maps r=0,…,b−2r=0,\ldots,b-2 bijectively to j=1,…,b−1j=1,\ldots,b-1. Since χ\chi is odd, χ(b2−a)=−χ(a)\chi(b^2-a)=-\chi(a), and therefore −Q=∑j=1b−1χ(j(b+1))=α∑j=1b−1χ(j)=αP.-Q=\sum_{j=1}^{b-1}\chi(j(b+1)) =\alpha\sum_{j=1}^{b-1}\chi(j)=\alpha P. Thus Q=−αPQ=-\alpha P, so SG(χ)=−2αPS_G(\chi)=-2\alpha P. Since b+1b+1 is a unit modulo b2b^2, ∣χ(b+1)∣=1|\chi(b+1)|=1, giving the absolute-square identity. ◻

Remark 6 (Short-window identity). Lemma 5 gives the phase-sensitive short-window identity for every odd character modulo b2b^2.

Prime-Base Carry Table

In prime base at lag one the same spectral energy has a direct table form. The asymptotic estimate is most concrete in this carry-table language.

Let bb be an odd prime. Throughout, a unit a mod b2a\bmod b^2 is represented by the unique integer 1≤a<b21\le a<b^2 with (a,b)=1(a,b)=1.

The raw lag-one table follows unit multiples of the two-digit diagonal. Write a residue n mod b2n\bmod b^2 as n=bq+rn=bq+r, 0≤q,r<b0\le q,r<b. The collision diagonal is G1,b={(b+1)d:0≤d<b},G_{1,b}=\{(b+1)d:0\le d<b\}, the set of two-digit words whose two digits agree. Multiplication by a unit aa permutes the residue system. For each diagonal point dd, the row entry records whether the translated point crosses the terminal boundary when advanced by aa. Id(a)=1 ⁣[(b+1)da mod b2≥b2−a].I_d(a)= \mathbf 1\!\left[(b+1)da\bmod b^2\ge b^2-a\right]. Equivalently, Id(a)=⌊((b+1)d+1)ab2⌋−⌊(b+1)dab2⌋.I_d(a)= \left\lfloor\frac{((b+1)d+1)a}{b^2}\right\rfloor - \left\lfloor\frac{(b+1)da}{b^2}\right\rfloor . Thus the row sum of this explicit collision table is the finite threshold-crossing count fb(a)=#{ 0≤d≤b−1 : (b+1) d a mod b2 ≥ b2−a },f_b(a)=\#\bigl\{\,0\le d\le b-1\ :\ (b+1)\,d\,a\bmod b^{2}\ \ge\ b^{2}-a\,\bigr\}, and the centered row statistic is S1(a)=fb(a)−1−⌊a−1b⌋,Vb=∑amodb2(a,b)=1S1(a)2.S_1(a)=f_b(a)-1-\Bigl\lfloor\tfrac{a-1}{b}\Bigr\rfloor,\qquad V_b=\sum_{\substack{a\bmod b^2\\(a,b)=1}}S_1(a)^2 . The prime-base lag-one collision energy is the class-centered square mass Eb=Vb−(b−1)(2b−1)6.E_b=V_b-\frac{(b-1)(2b-1)}6 . Equivalently, if S‾s\overline S_s is the mean of S1(bq+s)S_1(bq+s) over 0≤q<b0\le q<b, then S‾s=−(b−s)/b\overline S_s=-(b-s)/b, and Eb=∑s=1b−1∑q=0b−1(S1(bq+s)−S‾s)2.E_b=\sum_{s=1}^{b-1}\sum_{q=0}^{b-1} \bigl(S_1(bq+s)-\overline S_s\bigr)^2 . Finally set Tb(a)=2fb(a)−2 ⁣(1+⌊a−1b⌋)+1.T_b(a)=2f_b(a)-2\!\left(1+\Bigl\lfloor\tfrac{a-1}{b}\Bigr\rfloor\right)+1 . Thus Tb(a)=2S1(a)+1T_b(a)=2S_1(a)+1. The centered square mass of TbT_b is the half-centered table-side form of the collision energy.

A base-three example.

The units modulo 99 are 1,2,4,5,7,81,2,4,5,7,8. In that order, the six threshold counts and their class-centered values are a124578f3(a)122112S1(a)−S‾a mod 3234323−23−43−23\begin{array}{c|rrrrrr} a&1&2&4&5&7&8\\ f_3(a)&1&2&2&1&1&2\\ S_1(a)-\overline S_{a\bmod3} &\tfrac23&\tfrac43&\tfrac23&-\tfrac23&-\tfrac43&-\tfrac23 \end{array} and hence E3=∑a∈(Z/9Z)×∣S1(a)−S‾a mod 3∣2=163.E_3=\sum_{a\in(\mathbb{Z}/9\mathbb{Z})^\times} \bigl|S_1(a)-\overline S_{a\bmod3}\bigr|^2=\frac{16}{3}. The centering removes the separate means of the two residue classes modulo 33. What remains is the collision energy estimated below for general prime base.

Lemma 7 (Carry-table column law). Let bb be an odd prime and 1≤s≤b−11\le s\le b-1. Then ∑q=0b−1fb(bq+s)=b(b−1)2+s,S‾s:=1b∑q=0b−1S1(bq+s)=−b−sb.\sum_{q=0}^{b-1}f_b(bq+s)=\frac{b(b-1)}2+s, \qquad \overline S_s:=\frac1b\sum_{q=0}^{b-1}S_1(bq+s)=-\frac{b-s}{b}. Consequently ∑s=1b−1b S‾s 2=(b−1)(2b−1)6,\sum_{s=1}^{b-1}b\,\overline S_s^{\,2} =\frac{(b-1)(2b-1)}6, and Eb=∑s=1b−1∑q=0b−1(S1(bq+s)−S‾s)2.E_b=\sum_{s=1}^{b-1}\sum_{q=0}^{b-1} \bigl(S_1(bq+s)-\overline S_s\bigr)^2 .

Proof. Two elementary floor identities are used. If (m,b)=1(m,b)=1 and K∈ZK\in\mathbb{Z}, then ∑q=0b−1⌊mq+Kb⌋=(m−1)(b−1)2+K,\sum_{q=0}^{b-1}\Bigl\lfloor\frac{mq+K}{b}\Bigr\rfloor =\frac{(m-1)(b-1)}2+K, because the residues mq+K mod bmq+K\bmod b run once through 0,…,b−10,\ldots,b-1. For any integer m≥0m\ge0 and 0≤s<b0\le s<b, ⌊m(bq+s)b2⌋=⌊mq+⌊ms/b⌋b⌋.\Bigl\lfloor\frac{m(bq+s)}{b^2}\Bigr\rfloor = \Bigl\lfloor\frac{mq+\lfloor ms/b\rfloor}{b}\Bigr\rfloor . The threshold indicator has the floor-difference form 1[(y mod b2)≥b2−a]=⌊y+ab2⌋−⌊yb2⌋,\mathbf 1[(y\bmod b^2)\ge b^2-a] = \Bigl\lfloor\frac{y+a}{b^2}\Bigr\rfloor - \Bigl\lfloor\frac{y}{b^2}\Bigr\rfloor , with y=(b+1)day=(b+1)da. Therefore, for a=bq+sa=bq+s, fb(a)=∑d=0b−1(⌊((b+1)d+1)ab2⌋−⌊(b+1)d ab2⌋).f_b(a)=\sum_{d=0}^{b-1} \left( \Bigl\lfloor\frac{((b+1)d+1)a}{b^2}\Bigr\rfloor - \Bigl\lfloor\frac{(b+1)d\,a}{b^2}\Bigr\rfloor \right). For d=0d=0, this contribution is 00 for every qq. For 1≤d≤b−21\le d\le b-2, both multipliers (b+1)d(b+1)d and (b+1)d+1(b+1)d+1 are units modulo bb, and their contribution to ∑qfb(bq+s)\sum_q f_b(bq+s) is b−12+(⌊((b+1)d+1)sb⌋−⌊(b+1)d sb⌋)=b−12+εd,\frac{b-1}2+ \left( \Bigl\lfloor\frac{((b+1)d+1)s}{b}\Bigr\rfloor - \Bigl\lfloor\frac{(b+1)d\,s}{b}\Bigr\rfloor \right) = \frac{b-1}2+\varepsilon_d, where εd=1[(ds mod b)+s≥b].\varepsilon_d=\mathbf 1[(ds\bmod b)+s\ge b]. For d=b−1d=b-1, the upper multiplier is b2b^2, and the lower multiplier is b2−1b^2-1. The same calculation gives contribution bb.

As dd runs over 1,…,b−11,\ldots,b-1, the residue ds mod bds\bmod b runs over 1,…,b−11,\ldots,b-1, and exactly ss of these residues are at least b−sb-s. Since εb−1=1\varepsilon_{b-1}=1, the partial sum over 1≤d≤b−21\le d\le b-2 is s−1s-1. Hence ∑q=0b−1fb(bq+s)=(b−2)b−12+(s−1)+b=b(b−1)2+s.\sum_{q=0}^{b-1}f_b(bq+s) =(b-2)\frac{b-1}2+(s-1)+b =\frac{b(b-1)}2+s . It follows that ∑q=0b−1S1(bq+s)=b(b−1)2+s−b−b(b−1)2=s−b,\sum_{q=0}^{b-1}S_1(bq+s) =\frac{b(b-1)}2+s-b-\frac{b(b-1)}2=s-b, so S‾s=−(b−s)/b\overline S_s=-(b-s)/b. The square-mean identity follows by summing b(b−s)2/b2b(b-s)^2/b^2 over ss, and expanding the doubly centered mass gives Vb−∑sb S‾s 2=EbV_b-\sum_s b\,\overline S_s^{\,2}=E_b. ◻

Definition 8 (Centered collision function). For an odd prime bb, define S∘S^\circ on (Z/b2Z)×(\mathbb{Z}/b^2\mathbb{Z})^\times by S∘(a)=S1(a)−S‾a mod b,S^\circ(a)=S_1(a)-\overline S_{a\bmod b}, using the least positive representative 1≤a<b21\le a<b^2, and extend it by zero to nonunits. Lemma 7 gives ∑a∈(Z/b2Z)×∣S∘(a)∣2=Eb.\sum_{a\in(\mathbb{Z}/b^2\mathbb{Z})^\times}|S^\circ(a)|^2=E_b .

Lemma 9 (Primitive floor transform). Let χ\chi be a primitive odd character modulo b2b^2, and let mm be an integer with 1≤m<b21\le m<b^2 and (m,b)=1(m,b)=1. Then ∑amodb2(a,b)=1⌊mab2⌋χ‾(a)=(m−χ(m))B1,χ‾(b2).\sum_{\substack{a\bmod b^2\\(a,b)=1}} \Bigl\lfloor\frac{ma}{b^2}\Bigr\rfloor\overline\chi(a) = \bigl(m-\chi(m)\bigr)B_{1,\overline\chi}^{(b^2)} .

Proof. For a unit aa, the quotient ma/b2ma/b^2 is not an integer, so ⌊mab2⌋=mab2−( ⁣(mab2) ⁣)−12.\Bigl\lfloor\frac{ma}{b^2}\Bigr\rfloor = \frac{ma}{b^2} - \Bigl(\!\Bigl(\frac{ma}{b^2}\Bigr)\!\Bigr) -\frac12 . The constant term drops after summing against χ‾\overline\chi. The linear part gives mb2∑aaχ‾(a)=mB1,χ‾(b2).\frac{m}{b^2}\sum_a a\overline\chi(a)=mB_{1,\overline\chi}^{(b^2)}. For the sawtooth part, substitute a↦m−1aa\mapsto m^{-1}a and apply Lemma 2. ∑a( ⁣(mab2) ⁣)χ‾(a)=χ(m)∑a( ⁣(ab2) ⁣)χ‾(a)=χ(m)B1,χ‾(b2).\sum_a \Bigl(\!\Bigl(\frac{ma}{b^2}\Bigr)\!\Bigr)\overline\chi(a) = \chi(m)\sum_a \Bigl(\!\Bigl(\frac{a}{b^2}\Bigr)\!\Bigr)\overline\chi(a) = \chi(m)B_{1,\overline\chi}^{(b^2)}. Subtracting gives the identity. ◻

Theorem 10 (Lag-one collision factorization). Let bb be an odd prime and let χ\chi be a primitive odd character modulo b2b^2. Then S∘^(χ)=1φ(b2)∑amodb2(a,b)=1S∘(a)χ‾(a)=− B1,χ‾(b2) SG(χ)φ(b2).\widehat{S^\circ}(\chi) = \frac1{\varphi(b^2)} \sum_{\substack{a\bmod b^2\\(a,b)=1}}S^\circ(a)\overline\chi(a) = -\,\frac{B_{1,\overline\chi}^{(b^2)}\,S_G(\chi)}{\varphi(b^2)} .

Proof. The centering constant contributes nothing, since ∑a≡s (b)χ‾(a)=0\sum_{a\equiv s\,(b)}\overline\chi(a)=0 for primitive χ\chi. Indeed, a nonzero fiber sum would make χ\chi trivial on the kernel of (Z/b2Z)×→(Z/bZ)×(\mathbb{Z}/b^2\mathbb{Z})^\times\to(\mathbb{Z}/b\mathbb{Z})^\times, forcing χ\chi to descend to modulus bb. Thus ∑aS∘(a)χ‾(a)=∑aS1(a)χ‾(a).\sum_a S^\circ(a)\overline\chi(a)=\sum_a S_1(a)\overline\chi(a). The constant term in S1(a)=fb(a)−1−⌊(a−1)/b⌋S_1(a)=f_b(a)-1-\lfloor(a-1)/b\rfloor vanishes by nonprincipality. On units, ⌊(a−1)/b⌋=⌊a/b⌋\lfloor(a-1)/b\rfloor=\lfloor a/b\rfloor, and the sawtooth part of ⌊a/b⌋\lfloor a/b\rfloor depends only on a mod ba\bmod b, so its primitive character sum vanishes. Hence ∑a⌊a−1b⌋χ‾(a)=bB1,χ‾(b2).\sum_a\Bigl\lfloor\frac{a-1}{b}\Bigr\rfloor\overline\chi(a) = bB_{1,\overline\chi}^{(b^2)}.

For fbf_b, use the floor-difference formula from Lemma 7 with multipliers md+=(b+1)d+1m_d^+=(b+1)d+1 and md−=(b+1)dm_d^-=(b+1)d. The exceptional terms are m0−=0m_0^-=0, which contributes 00, and mb−1+=b2m_{b-1}^+=b^2, whose floor is aa and therefore contributes b2B1,χ‾(b2)b^2B_{1,\overline\chi}^{(b^2)}. Lemma 9 gives all remaining terms, so ∑afb(a)χ‾(a)=b2B1,χ‾(b2)+B1,χ‾(b2)[∑d=0b−2(md+−χ(md+))−∑d=1b−1(md−−χ(md−))].\begin{aligned} \sum_a f_b(a)\overline\chi(a) &= b^2B_{1,\overline\chi}^{(b^2)}\\ &\quad+ B_{1,\overline\chi}^{(b^2)} \left[ \sum_{d=0}^{b-2}\bigl(m_d^+-\chi(m_d^+)\bigr) - \sum_{d=1}^{b-1}\bigl(m_d^--\chi(m_d^-)\bigr) \right]. \end{aligned} The integer parts satisfy ∑d=0b−2md+−∑d=1b−1md−=−b(b−1),\sum_{d=0}^{b-2}m_d^+-\sum_{d=1}^{b-1}m_d^-=-b(b-1), so their net contribution with the exceptional term is bB1,χ‾(b2)bB_{1,\overline\chi}^{(b^2)}. For the character parts, ∑d=0b−2χ(md+)−∑d=1b−1χ(md−)=Q−χ(b+1)Sχ=−2χ(b+1)Sχ=SG(χ),\sum_{d=0}^{b-2}\chi(m_d^+)-\sum_{d=1}^{b-1}\chi(m_d^-) = Q-\chi(b+1)S_\chi = -2\chi(b+1)S_\chi = S_G(\chi), using Lemma 5. Therefore ∑afb(a)χ‾(a)=bB1,χ‾(b2)−B1,χ‾(b2)SG(χ).\sum_a f_b(a)\overline\chi(a) = bB_{1,\overline\chi}^{(b^2)} - B_{1,\overline\chi}^{(b^2)}S_G(\chi). Subtracting the ⌊(a−1)/b⌋\lfloor(a-1)/b\rfloor contribution cancels the bB1,χ‾(b2)bB_{1,\overline\chi}^{(b^2)} term and leaves ∑aS1(a)χ‾(a)=−B1,χ‾(b2)SG(χ).\sum_a S_1(a)\overline\chi(a) = -B_{1,\overline\chi}^{(b^2)}S_G(\chi). Dividing by φ(b2)\varphi(b^2) proves the theorem. ◻

Lemma 11 (Carry-table reflection law). Let aa be a unit represented by 1≤a<b21\le a<b^2, and put a∗=b2−aa^\ast=b^2-a. Then fb(a)+fb(a∗)=b,Tb(a∗)=−Tb(a),f_b(a)+f_b(a^\ast)=b,\qquad T_b(a^\ast)=-T_b(a), and S∘(b2−a)=−S∘(a).S^\circ(b^2-a)=-S^\circ(a).

Proof. Put xd=(b+1)da mod b2x_d=(b+1)da\bmod b^2. For a∗=b2−aa^\ast=b^2-a, the reflected residue is −xd mod b2-x_d\bmod b^2. The term d=0d=0 contributes to neither threshold. For 1≤d≤b−11\le d\le b-1, the two threshold indicators sum to 1+1[xd=b2−a].1+\mathbf 1[x_d=b^2-a]. The congruence xd=b2−ax_d=b^2-a is equivalent to (b+1)d≡−1 mod b2(b+1)d\equiv -1\bmod b^2, whose unique solution in 1≤d≤b−11\le d\le b-1 is d=b−1d=b-1. Hence fb(a)+fb(a∗)=bf_b(a)+f_b(a^\ast)=b.

If a=bq+sa=bq+s, 1≤s<b1\le s<b, then a∗=b(b−1−q)+(b−s)a^\ast=b(b-1-q)+(b-s), so S1(a)+S1(a∗)=fb(a)+fb(a∗)−1−q−1−(b−1−q)=−1.S_1(a)+S_1(a^\ast) =f_b(a)+f_b(a^\ast)-1-q-1-(b-1-q)=-1. Equivalently, Tb(a∗)=−Tb(a)T_b(a^\ast)=-T_b(a). Since S‾s+S‾b−s=−1\overline S_s+\overline S_{b-s}=-1, the centered function satisfies S∘(a)+S∘(a∗)=S1(a)+S1(a∗)−S‾s−S‾b−s=0.S^\circ(a)+S^\circ(a^\ast) = S_1(a)+S_1(a^\ast)-\overline S_s-\overline S_{b-s}=0. ◻

Corollary 12 (Lag-one spectral energy formula). For odd primes bb, with Sχ=∑k=1b−1χ(k)S_\chi=\sum_{k=1}^{b-1}\chi(k), Eb=4φ(b2)∑χmodb2 primitiveχ(−1)=−1∣B1,χ(b2)∣2 ∣Sχ∣2.E_b=\frac{4}{\varphi(b^2)} \sum_{\substack{\chi\bmod b^2\ \mathrm{primitive}\\\chi(-1)=-1}} |B_{1,\chi}^{(b^2)}|^2\,|S_\chi|^2 .

Proof. Lemma 11 gives S∘(b2−a)=−S∘(a)S^\circ(b^2-a)=-S^\circ(a), so even characters vanish. If χ\chi is imprimitive modulo b2b^2, induced from modulus bb, then χ\chi is constant on each residue class modulo bb, and the class-centering gives ∑amodb2(a,b)=1S∘(a)χ(a)‾=∑s=1b−1χ(s)‾∑q=0b−1S∘(bq+s)=0.\sum_{\substack{a\bmod b^2\\(a,b)=1}}S^\circ(a)\overline{\chi(a)} = \sum_{s=1}^{b-1}\overline{\chi(s)} \sum_{q=0}^{b-1}S^\circ(bq+s)=0 . Thus the imprimitive sector vanishes directly from the table centering. Parseval on (Z/b2Z)×(\mathbb{Z}/b^2\mathbb{Z})^\times, together with Definition 8 and Theorem 10, gives Eb=φ(b2)∑χ primitive odd∣S∘^(χ)∣2=1φ(b2)∑χ primitive odd∣B1,χ(b2)∣2∣SG(χ)∣2.E_b = \varphi(b^2) \sum_{\chi\ \mathrm{primitive\ odd}} |\widehat{S^\circ}(\chi)|^2 = \frac1{\varphi(b^2)} \sum_{\chi\ \mathrm{primitive\ odd}} |B_{1,\chi}^{(b^2)}|^2|S_G(\chi)|^2. Finally, ∣SG(χ)∣2=4∣Sχ∣2|S_G(\chi)|^2=4|S_\chi|^2 by Lemma 5. ◻

Theorem 13 (Threshold-energy normalization). For odd prime bb, the lag-one threshold variance satisfies Vb=∑amodb2(a,b)=1(fb(a)−1−⌊a−1b⌋)2.V_b=\sum_{\substack{a\bmod b^{2}\\(a,b)=1}}\left(f_b(a)-1-\Bigl\lfloor\tfrac{a-1}{b}\Bigr\rfloor\right)^{2}. With Tb(a)=2S1(a)+1T_b(a)=2S_1(a)+1, one has the exact normalizations Vb=14∑amodb2(a,b)=1Tb(a)2+14b(b−1),V_b=\frac14\sum_{\substack{a\bmod b^{2}\\(a,b)=1}}T_b(a)^2+\frac14b(b-1), and Eb=14∑amodb2(a,b)=1Tb(a)2−(b−1)(b−2)12.E_b=\frac14\sum_{\substack{a\bmod b^{2}\\(a,b)=1}}T_b(a)^2-\frac{(b-1)(b-2)}{12}.

Proof. The lag-one diagonal has step b+1b+1. In row aa, multiplication by (b+1)d(b+1)d crosses the terminal boundary of the modulus exactly when (b+1)da mod b2≥b2−a.(b+1)da\bmod b^2\ge b^2-a . Thus fb(a)f_b(a) is the number of diagonal steps whose translate crosses the right endpoint of the aa-window. The deterministic block count is μb(a)=1+⌊a−1b⌋,\mu_b(a)=1+\Bigl\lfloor\tfrac{a-1}{b}\Bigr\rfloor, the number of base-bb blocks met by the interval of length aa, including its final partial block. Hence the threshold variance is Vb=∑(a,b)=1(fb(a)−μb(a))2.V_b=\sum_{(a,b)=1}\bigl(f_b(a)-\mu_b(a)\bigr)^2 . The class-centering correction enters later through the means S‾s\overline S_s. The half-centered integer normalization satisfies Tb(a)=2(fb(a)−μb(a))+1,T_b(a)=2\bigl(f_b(a)-\mu_b(a)\bigr)+1, so Tb(a)=2S1(a)+1T_b(a)=2S_1(a)+1. The reflection a∗=b2−aa^\ast=b^2-a gives Tb(a∗)=−Tb(a)T_b(a^\ast)=-T_b(a) by Lemma 11. Since S1(a)2=14Tb(a)2−12Tb(a)+14,S_1(a)^2=\frac14T_b(a)^2-\frac12T_b(a)+\frac14, the linear term cancels after summing over reflection pairs of units, and ∑(a,b)=1S1(a)2=14∑(a,b)=1Tb(a)2+14φ(b2).\sum_{(a,b)=1}S_1(a)^2 =\frac14\sum_{(a,b)=1}T_b(a)^2+\frac14\varphi(b^2). Thus Vb=14∑(a,b)=1Tb(a)2+14b(b−1).V_b=\frac14\sum_{(a,b)=1}T_b(a)^2+\frac14b(b-1). The class-centering correction is exact. Eb=Vb−(b−1)(2b−1)6.E_b=V_b-\frac{(b-1)(2b-1)}6 . Indeed, S‾s=−(b−s)/b\overline S_s=-(b-s)/b, so ∑s=1b−1b S‾s 2=1b∑s=1b−1(b−s)2=(b−1)(2b−1)6.\sum_{s=1}^{b-1}b\,\overline S_s^{\,2} =\frac1b\sum_{s=1}^{b-1}(b-s)^2 =\frac{(b-1)(2b-1)}6 . Consequently Eb=14∑(a,b)=1Tb(a)2+14b(b−1)−(b−1)(2b−1)6,E_b=\frac14\sum_{(a,b)=1}T_b(a)^2 +\frac14b(b-1)-\frac{(b-1)(2b-1)}6, or, in compact form, Eb=14∑(a,b)=1Tb(a)2−(b−1)(b−2)12.E_b=\frac14\sum_{(a,b)=1}T_b(a)^2 -\frac{(b-1)(b-2)}{12}. Thus the difference between EbE_b and 14∑Tb(a)2\frac14\sum T_b(a)^2 is O(b2)O(b^2) with a displayed closed form. ◻

Theorem 13 shows that the cubic energy law is equivalent to ∑(a,b)=1Tb(a)2=4b3+O ⁣(b2(log⁡b)2).\sum_{(a,b)=1}T_b(a)^2 =4b^3+O\!\left(b^2(\log b)^2\right).

Dedekind Compression

The same prime-base energy compresses into a weighted average of classical Dedekind sums. This places the finite collision table inside a standard analytic object without changing the source of the weight.

Two steps produce the compression. Bernoulli coefficients first turn the centered mass into a cotangent-pair kernel. The classical cotangent identity then evaluates that kernel as a Dedekind sum. Second, the collision geometry supplies the weight. A residue v mod b2v\bmod b^2 is counted exactly as many times as there are window entries kk for which kvkv lands back in the first digit window {1,…,b−1}\{1,\ldots,b-1\}. Thus the Dedekind sum is classical, but the weight is the original carry-boundary collision count.

Definition 14 (Dedekind sum). For (h,m)=1(h,m)=1 set ((x))={{x}−12,x∉Z,0,x∈Z,s(h,m)=∑a=1m−1( ⁣(am) ⁣)( ⁣(ham) ⁣).((x))=\begin{cases}\{x\}-\tfrac12,&x\notin\mathbb{Z},\\0,&x\in\mathbb{Z},\end{cases}\qquad s(h,m)=\sum_{a=1}^{m-1}\Bigl(\!\Bigl(\tfrac am\Bigr)\!\Bigr)\Bigl(\!\Bigl(\tfrac{ha}{m}\Bigr)\!\Bigr).

Definition 15 (Collision weight). For a unit vv modulo b2b^{2} define wb(v)=#{ 1≤k≤b−1 : vk mod b2∈{1,…,b−1} }.w_b(v)=\#\bigl\{\,1\le k\le b-1\ :\ vk\bmod b^{2}\in\{1,\dots,b-1\}\,\bigr\}. Writing v=α+bβv=\alpha+b\beta with 1≤α≤b−11\le\alpha\le b-1, this is wb(α+bβ)=#{ 1≤k≤b−1 : βk+⌊αk/b⌋≡0(modb) }.w_b(\alpha+b\beta)=\#\Bigl\{\,1\le k\le b-1\ :\ \beta k+\bigl\lfloor \alpha k/b\bigr\rfloor\equiv 0\pmod b\,\Bigr\}.

Theorem 16 (Weighted Dedekind identity). For odd prime bb, the prime-base lag-one energy satisfies Eb=1b2∑vmodb2(v,b)=1wb(v)(4b2 s(v,b2)−4b s(v mod b, b)).E_b=\frac1{b^{2}}\sum_{\substack{v\bmod b^{2}\\(v,b)=1}}w_b(v)\Bigl(4b^{2}\,s(v,b^{2})-4b\,s(v\bmod b,\,b)\Bigr). The mod-bb correction cancels after weighting, so Eb=4∑vmodb2(v,b)=1wb(v) s(v,b2).E_b=4\sum_{\substack{v\bmod b^{2}\\(v,b)=1}}w_b(v)\,s(v,b^{2}).

Proof. Put q=b2q=b^2. By the lag-one spectral energy identity, Corollary 12, Eb=4φ(q)∑χmodq primitiveχ(−1)=−1∣B1,χ∣2 ∣Sχ∣2,Sχ=∑k=1b−1χ(k).E_b=\frac{4}{\varphi(q)} \sum_{\substack{\chi\bmod q\ {\rm primitive}\\ \chi(-1)=-1}} |B_{1,\chi}|^2\,|S_\chi|^2,\qquad S_\chi=\sum_{k=1}^{b-1}\chi(k). Imprimitive odd characters modulo qq are induced from modulus bb, and the window sum SχS_\chi vanishes on them by orthogonality over the complete reduced residue system modulo bb. The displayed primitive sum is therefore the full odd contribution.

For every character χ mod q\chi\bmod q, put Cχ=∑umodq(u,q)=1χ‾(u)cot⁡πuq.C_\chi=\sum_{\substack{u\bmod q\\(u,q)=1}} \overline\chi(u)\cot\frac{\pi u}{q}. With τ(χ)=∑a mod qχ(a)e2πia/q,\tau(\chi)=\sum_{a\bmod q}\chi(a)e^{2\pi i a/q}, the standard finite cotangent transform [19, 20] gives, for primitive odd χ\chi, Cχ=2i τ(χ‾)B1,χ=−2iqτ(χ)B1,χ.C_\chi =2i\,\tau(\overline\chi)B_{1,\chi} =-\frac{2iq}{\tau(\chi)}B_{1,\chi}. Since ∣τ(χ)∣=q\lvert\tau(\chi)\rvert=\sqrt q, 4q ∣B1,χ∣2=∣Cχ∣24q\,|B_{1,\chi}|^2=|C_\chi|^2 and hence, since q=b2q=b^2, qEb=1φ(q)∑χmodq primitiveχ(−1)=−1∣Cχ∣2∣Sχ∣2.qE_b = \frac1{\varphi(q)} \sum_{\substack{\chi\bmod q\ {\rm primitive}\\ \chi(-1)=-1}} |C_\chi|^2|S_\chi|^2 . On the other hand, define K(u)=∑k=1b−1cot⁡π(uk−1 mod q)q.K(u)=\sum_{k=1}^{b-1} \cot\frac{\pi(uk^{-1}\bmod q)}{q}. The function K(u)K(u) is real-valued, and multiplicative Parseval on (Z/qZ)×(\mathbb{Z}/q\mathbb{Z})^\times gives ∑umodq(u,b)=1∣K(u)∣2=1φ(q)∑χ mod q∣Cχ∣2∣Sχ∣2.\sum_{\substack{u\bmod q\\(u,b)=1}}|K(u)|^2 = \frac1{\varphi(q)} \sum_{\chi\bmod q}|C_\chi|^2|S_\chi|^2 . Indeed, the χ\chi-coefficient of KK is 1φ(q)∑uK(u)χ‾(u)=1φ(q)(∑k=1b−1χ‾(k))Cχ.\frac1{\varphi(q)}\sum_{u}K(u)\overline\chi(u) = \frac1{\varphi(q)} \left(\sum_{k=1}^{b-1}\overline\chi(k)\right)C_\chi . Even characters have Cχ=0C_\chi=0, and imprimitive odd characters have Sχ=0S_\chi=0, so the full character sum reduces to the primitive odd sum above. Thus b2Eb=∑umodq(u,b)=1∣K(u)∣2.b^2E_b = \sum_{\substack{u\bmod q\\(u,b)=1}}|K(u)|^2 . Expanding this square gives a sum over pairs k,ℓ∈{1,…,b−1}k,\ell\in\{1,\ldots,b-1\}. After the change of variables x=uk−1x=uk^{-1} and v≡kℓ−1(modq)v\equiv k\ell^{-1}\pmod q, this becomes ∑umodq(u,b)=1∣K(u)∣2=∑vmodq(v,b)=1wb(v) Γ(v),\sum_{\substack{u\bmod q\\(u,b)=1}}|K(u)|^2 = \sum_{\substack{v\bmod q\\(v,b)=1}}w_b(v)\,\Gamma(v), where Γ(v)=∑umodq(u,b)=1cot⁡πuqcot⁡πuvq.\Gamma(v)= \sum_{\substack{u\bmod q\\(u,b)=1}} \cot\frac{\pi u}{q}\cot\frac{\pi uv}{q}. The multiplicity of a given ratio vv is exactly wb(v)w_b(v), because it counts the first-window entries rr for which vr mod qvr\bmod q is again in the first window.

It remains to evaluate Γ(v)\Gamma(v). The classical cotangent-Dedekind identity ∑a=1m−1cot⁡πamcot⁡πham=4m s(h,m)\sum_{a=1}^{m-1}\cot\frac{\pi a}{m}\cot\frac{\pi ha}{m} =4m\,s(h,m) gives 4q s(v,q)4q\,s(v,q) when summed over all 1≤u<q1\le u<q. The excluded nonunits are u=btu=bt, 1≤t<b1\le t<b, and their contribution is ∑t=1b−1cot⁡πtbcot⁡π(v mod b)tb=4b s(v mod b,b).\sum_{t=1}^{b-1} \cot\frac{\pi t}{b}\cot\frac{\pi(v\bmod b)t}{b} =4b\,s(v\bmod b,b). Thus Γ(v)=4b2s(v,b2)−4b s(v mod b,b),\Gamma(v)=4b^2s(v,b^2)-4b\,s(v\bmod b,b), and division by b2b^2 gives the first displayed identity.

For the correction term, write v=α+bβv=\alpha+b\beta. For fixed α\alpha, ∑β mod bwb(α+bβ)=b−1.\sum_{\beta\bmod b}w_b(\alpha+b\beta)=b-1. Indeed, for each 1≤k<b1\le k<b the congruence βk+⌊αk/b⌋≡0(modb)\beta k+\bigl\lfloor\alpha k/b\bigr\rfloor\equiv0\pmod b has a unique solution β mod b\beta\bmod b, since kk is a unit modulo bb. Thus the correction contributes (b−1)∑α=1b−1s(α,b)=0,(b-1)\sum_{\alpha=1}^{b-1}s(\alpha,b)=0, by the reflection s(−u,b)=−s(u,b)s(-u,b)=-s(u,b). The weighted identity therefore reduces to Eb=4∑vwb(v)s(v,b2).E_b=4\sum_v w_b(v)s(v,b^2). ◻

Corollary 17 (Prime-square energy dictionary). For odd primes bb, the threshold energy, the centered carry mass, the primitive odd character mass, and the weighted Dedekind average are the same finite object. Eb=∑a∈(Z/b2Z)×∣S∘(a)∣2=4φ(b2)∑χmodb2 primitiveχ(−1)=−1∣B1,χ(b2)∣2∣Sχ∣2=4∑vmodb2(v,b)=1wb(v)s(v,b2).\begin{aligned} E_b &=\sum_{a\in(\mathbb{Z}/b^2\mathbb{Z})^\times}|S^\circ(a)|^2\\ &=\frac{4}{\varphi(b^2)} \sum_{\substack{\chi\bmod b^2\ {\rm primitive}\\ \chi(-1)=-1}} |B_{1,\chi}^{(b^2)}|^2|S_\chi|^2\\ &=4\sum_{\substack{v\bmod b^2\\(v,b)=1}}w_b(v)s(v,b^2). \end{aligned}

Proof. The first identity is Definition 8, the second is Corollary 12, and the third is Theorem 16. ◻

Proposition 18 (Weight-free collision double sum). The weighted Dedekind energy is equivalently Eb=4∑k=1b−1∑u=1b−1s(k−1u mod b2, b2),E_b=4\sum_{k=1}^{b-1}\sum_{u=1}^{b-1}s\bigl(k^{-1}u\bmod b^{2},\,b^{2}\bigr), where k−1k^{-1} is taken modulo b2b^{2}.

Proof. By definition wb(v)w_b(v) counts the pairs (k,u)(k,u) with 1≤k,u≤b−11\le k,u\le b-1 and kv≡u(modb2)kv\equiv u\pmod{b^{2}}. Since kk is a unit modulo b2b^{2}, the congruence determines v≡k−1u(modb2)v\equiv k^{-1}u\pmod{b^{2}}. Substituting this parametrization into Eb=4∑vwb(v)s(v,b2)E_b=4\sum_v w_b(v)s(v,b^{2}) gives the identity. ◻

This identity removes the weight entirely. Instead of asking how often a given vv occurs, the sum runs directly over the two window coordinates (k,u)(k,u). The diagonal u=ku=k is then visible without further analysis, and the off-diagonal can be grouped by the reduced rational ratio u/ku/k.

Lemma 19 (Reduced-ratio invariance). If g=gcd⁡(k,u)g=\gcd(k,u), k=gk′k=gk', and u=gu′u=gu', then s(k−1u mod b2, b2)=s(k′−1u′ mod b2, b2),s\bigl(k^{-1}u\bmod b^{2},\,b^{2}\bigr)=s\bigl(k'^{-1}u'\bmod b^{2},\,b^{2}\bigr), so each summand in Proposition 18 depends only on the reduced rational ratio u/ku/k.

Proof. Because 1≤g<b1\le g<b, the integer gg is a unit modulo b2b^{2}. Therefore (gk′)−1(gu′)≡k′−1u′(modb2)(gk')^{-1}(gu')\equiv k'^{-1}u'\pmod{b^{2}}, and the Dedekind sum depends only on the residue class of its first argument modulo b2b^{2}. ◻

Proposition 20 (Reduced-ratio pole split). The diagonal part of the double sum is Δb=4(b−1)s(1,b2)=(b−1)(b2−1)(b2−2)3b2=13b3+O(b2).\Delta_b=4(b-1)s(1,b^{2})=\frac{(b-1)(b^{2}-1)(b^{2}-2)}{3b^{2}}=\frac13 b^{3}+O(b^{2}). The off-diagonal part is exactly Offb=8∑1≤k<a≤b−1(a,k)=1⌊b−1a⌋ s(k−1a mod b2, b2),\mathrm{Off}_b=8\sum_{\substack{1\le k<a\le b-1\\(a,k)=1}}\Bigl\lfloor\tfrac{b-1}{a}\Bigr\rfloor\,s\bigl(k^{-1}a\bmod b^{2},\,b^{2}\bigr), and Eb=Δb+OffbE_b=\Delta_b+\mathrm{Off}_b.

Proof. On the diagonal u=ku=k the residue is k−1u≡1(modb2)k^{-1}u\equiv 1\pmod{b^{2}}, which gives Δb=4(b−1)s(1,b2).\Delta_b=4(b-1)s(1,b^{2}). The classical evaluation s(1,m)=(m−1)(m−2)/(12m)s(1,m)=(m-1)(m-2)/(12m) with m=b2m=b^{2} [19] produces the displayed closed form.

For u≠ku\ne k, the two orientations (k,u)(k,u) and (u,k)(u,k) have inverse Dedekind arguments. The symmetry s(h,m)=s(h−1,m)s(h,m)=s(h^{-1},m), obtained from the substitution x↦hxx\mapsto hx in the defining sum, lets us pair these two orientations with a factor 22, choosing the orientation whose larger reduced coordinate is aa. Write (k,u)=(tk′,ta′),a′>k′≥1,(a′,k′)=1.(k,u)=(t k',t a'),\qquad a'>k'\ge1,\qquad (a',k')=1. The condition 1≤k,u≤b−11\le k,u\le b-1 is then exactly 1≤t≤⌊b−1a′⌋.1\le t\le \Bigl\lfloor\frac{b-1}{a'}\Bigr\rfloor . Renaming (a′,k′)(a',k') as (a,k)(a,k), each reduced pair occurs with multiplicity ⌊(b−1)/a⌋\lfloor(b-1)/a\rfloor. The original factor 44 in the double sum and the two orientations give the factor 88. ◻

Lemma 21 (Coprime Euler sum). Σ:=∑a>k≥1(a,k)=11ka2=1.\Sigma:=\sum_{\substack{a>k\ge 1\\(a,k)=1}}\frac1{ka^{2}}=1.

Proof. Let Hn=∑j=1nj−1H_n=\sum_{j=1}^n j^{-1}, with H0=0H_0=0. The series below are absolutely convergent, so Möbius inversion and rearrangement give Σ=∑d≥1μ(d)∑a′>k′≥11(dk′)(da′)2=∑d≥1μ(d)d3∑a′>k′≥11k′(a′)2=1ζ(3)∑a≥2Ha−1a2.\Sigma =\sum_{d\ge1}\mu(d)\sum_{a'>k'\ge1} \frac1{(dk')(da')^2} =\sum_{d\ge 1}\frac{\mu(d)}{d^{3}} \sum_{a'>k'\ge 1}\frac1{k'(a')^{2}} =\frac1{\zeta(3)}\sum_{a\ge 2}\frac{H_{a-1}}{a^{2}} . The classical Euler sum ∑a≥1Ha/a2=2ζ(3)\sum_{a\ge 1}H_a/a^{2}=2\zeta(3) [7] gives ∑a≥2Ha−1a2=∑a≥2Haa2−∑a≥21a3=(2ζ(3)−1)−(ζ(3)−1)=ζ(3).\sum_{a\ge 2}\frac{H_{a-1}}{a^{2}}=\sum_{a\ge 2}\frac{H_a}{a^{2}}-\sum_{a\ge 2}\frac1{a^{3}}=\bigl(2\zeta(3)-1\bigr)-\bigl(\zeta(3)-1\bigr)=\zeta(3). Thus Σ=1\Sigma=1. ◻

Lemma 22 (Rademacher reciprocity reduction). For coprime integers 1≤k<a≤b−11\le k<a\le b-1, s(k−1a mod b2, b2)=b212ka+112(akb2+kab2)−14−s(k b2‾(a),a)−s(b2 a‾(k),k),\begin{aligned} s\bigl(k^{-1}a\bmod b^{2},\,b^{2}\bigr) &=\frac{b^{2}}{12ka} +\frac1{12}\Bigl(\frac{a}{kb^{2}}+\frac{k}{ab^{2}}\Bigr) -\frac14\\ &\quad -s\bigl(k\,\overline{b^{2}}^{(a)},a\bigr) -s\bigl(b^{2}\,\overline{a}^{(k)},k\bigr), \end{aligned} where b2‾(a)\overline{b^{2}}^{(a)} is the inverse of b2b^{2} modulo aa. For k≥2k\ge2, a‾(k)\overline{a}^{(k)} is the inverse of aa modulo kk; for k=1k=1, the final Dedekind sum is interpreted as 00.

Proof. When k=1k=1, ordinary two-term reciprocity for the coprime pair (a,b2)(a,b^2) gives s(a,b2)+s(b2,a)=−14+112(ab2+b2a+1ab2).s(a,b^2)+s(b^2,a) =-\frac14+\frac1{12}\left(\frac{a}{b^2} +\frac{b^2}{a}+\frac1{ab^2}\right). The symmetry s(h,a)=s(h−1,a)s(h,a)=s(h^{-1},a) identifies s(b2,a)s(b^2,a) with s(b2‾(a),a)s(\overline{b^2}^{(a)},a), which is the displayed formula with the final modulus-one term equal to zero.

Now suppose k≥2k\ge2. In the following display mj(mi)m_j^{(m_i)} denotes the inverse of mjm_j modulo mim_i. Rademacher’s three-term reciprocity [18] (see also [19]) states that for pairwise coprime positive integers m1,m2,m3m_1,m_2,m_3, s(m2m3(m1),m1)+s(m3m1(m2),m2)+s(m1m2(m3),m3)=−14+112(m1m2m3+m2m3m1+m3m1m2).\begin{aligned} s\bigl(m_2 m_3^{(m_1)},m_1\bigr) &+s\bigl(m_3 m_1^{(m_2)},m_2\bigr) +s\bigl(m_1 m_2^{(m_3)},m_3\bigr)\\ &=-\frac14+\frac1{12}\Bigl( \frac{m_1}{m_2 m_3} +\frac{m_2}{m_3 m_1} +\frac{m_3}{m_1 m_2}\Bigr). \end{aligned} Apply this with (m1,m2,m3)=(b2,a,k)(m_1,m_2,m_3)=(b^{2},a,k). The first term is s(k−1a mod b2,b2)s(k^{-1}a\bmod b^{2},b^{2}), and solving for it gives the displayed identity. ◻

The four pieces of the exact off-diagonal decomposition are the four terms of Rademacher reciprocity after summing over reduced ratios. The large term b2/(12ka)b^2/(12ka) gives Mainb\mathrm{Main}_b. The constant and tiny reciprocal terms give Rb(0)R_b^{(0)}. The Dedekind sum at modulus aa gives Rb(a)R_b^{(a)}, which vanishes because the kk-sum runs over a full reduced residue system modulo aa. The Dedekind sum at modulus kk gives Rb(k)R_b^{(k)}, the only surviving analytic remainder.

Proposition 23 (Four-way off-diagonal decomposition). The off-diagonal contribution decomposes exactly as Offb=Mainb+Rb(0)+Rb(a)+Rb(k),\mathrm{Off}_b=\mathrm{Main}_b+R_b^{(0)}+R_b^{(a)}+R_b^{(k)}, where every displayed sum runs over a>k≥1a>k\ge 1, (a,k)=1(a,k)=1, a≤b−1a\le b-1, and Mainb=2b23∑1ka⌊b−1a⌋,Rb(0)=8∑⌊b−1a⌋ ⁣[112(akb2+kab2)−14],\mathrm{Main}_b=\frac{2b^{2}}{3}\sum\frac1{ka}\Bigl\lfloor\tfrac{b-1}{a}\Bigr\rfloor,\qquad R_b^{(0)}=8\sum\Bigl\lfloor\tfrac{b-1}{a}\Bigr\rfloor\!\left[\frac1{12}\Bigl(\frac{a}{kb^{2}}+\frac{k}{ab^{2}}\Bigr)-\frac14\right], Rb(a)=−8∑⌊b−1a⌋s(k b2‾(a),a),Rb(k)=−8∑k≥2⌊b−1a⌋s(b2 a‾(k),k).R_b^{(a)}=-8\sum\Bigl\lfloor\tfrac{b-1}{a}\Bigr\rfloor s\bigl(k\,\overline{b^{2}}^{(a)},a\bigr),\qquad R_b^{(k)}=-8\sum_{\substack{k\ge2}}\Bigl\lfloor\tfrac{b-1}{a}\Bigr\rfloor s\bigl(b^{2}\,\overline{a}^{(k)},k\bigr).

Proof. Start from Proposition 20. Offb=8∑⌊b−1a⌋s(k−1a mod b2,b2),\mathrm{Off}_b =8\sum\Bigl\lfloor\tfrac{b-1}{a}\Bigr\rfloor s(k^{-1}a\bmod b^2,b^2), where the sum is over reduced pairs a>k≥1a>k\ge1, a≤b−1a\le b-1. Substituting Lemma 22 into each summand gives 8∑⌊b−1a⌋[b212ka+112(akb2+kab2)−14−s(kb2‾(a),a)−s(b2a‾(k),k)].8\sum\Bigl\lfloor\tfrac{b-1}{a}\Bigr\rfloor \left[ \frac{b^2}{12ka} + \frac1{12}\left(\frac{a}{kb^2}+\frac{k}{ab^2}\right) -\frac14 -s(k\overline{b^2}^{(a)},a) -s(b^2\overline a^{(k)},k) \right]. The first term is 8⋅b212∑1ka⌊b−1a⌋=Mainb.8\cdot\frac{b^2}{12} \sum\frac1{ka}\Bigl\lfloor\tfrac{b-1}{a}\Bigr\rfloor =\mathrm{Main}_b. The constant and reciprocal terms are Rb(0)R_b^{(0)}, and the two small-modulus Dedekind sums are Rb(a)R_b^{(a)} and Rb(k)R_b^{(k)}. These four collected pieces are exactly the displayed decomposition. ◻

Lemma 24 (Off-diagonal main term). Mainb=23b3+O ⁣(b2(log⁡b)2).\mathrm{Main}_b=\frac23 b^{3}+O\!\left(b^{2}(\log b)^{2}\right).

Proof. Put c(a)=∑1≤k<a(k,a)=11k ≤ Ha−1 ≪ log⁡a.c(a)=\sum_{\substack{1\le k<a\\(k,a)=1}}\frac1k\ \le\ H_{a-1}\ \ll\ \log a . Then Mainb=2b23∑2≤a≤b−11a⌊b−1a⌋c(a).\mathrm{Main}_b=\frac{2b^{2}}{3}\sum_{2\le a\le b-1}\frac1a\Bigl\lfloor\tfrac{b-1}{a}\Bigr\rfloor c(a). Writing ⌊(b−1)/a⌋=(b−1)/a−{(b−1)/a}\lfloor(b-1)/a\rfloor=(b-1)/a-\{(b-1)/a\}, the principal part is 2b2(b−1)3∑a<bc(a)a2.\frac{2b^{2}(b-1)}{3}\sum_{a<b}\frac{c(a)}{a^{2}} . By Lemma 21, ∑a≥2c(a)/a2=1\sum_{a\ge 2}c(a)/a^{2}=1, and the tail satisfies ∑a≥bc(a)a2 ≪ ∑a≥blog⁡aa2 ≪ log⁡bb,\sum_{a\ge b}\frac{c(a)}{a^{2}}\ \ll\ \sum_{a\ge b}\frac{\log a}{a^{2}}\ \ll\ \frac{\log b}{b}, so the principal part is 23b3+O(b2log⁡b)\tfrac23 b^{3}+O(b^{2}\log b). The floor-defect term is bounded by O ⁣(b2∑a<bc(a)a)=O ⁣(b2(log⁡b)2).O\!\Bigl(b^{2}\sum_{a<b}\frac{c(a)}{a}\Bigr)=O\!\left(b^{2}(\log b)^{2}\right). ◻

Lemma 25 (Constant Rademacher remainder). Rb(0)=O(b2).R_b^{(0)}=O(b^{2}).

Proof. The bracket in Rb(0)R_b^{(0)} is O(1)O(1), so Rb(0) ≪ ∑a<b⌊b−1a⌋φ(a) ≪ b∑a<bφ(a)a ≪ b2.R_b^{(0)}\ \ll\ \sum_{a<b}\Bigl\lfloor\tfrac{b-1}{a}\Bigr\rfloor\varphi(a)\ \ll\ b\sum_{a<b}\frac{\varphi(a)}{a}\ \ll\ b^{2}. ◻

Lemma 26 (aa-modulus cancellation). Rb(a)=0.R_b^{(a)}=0.

Proof. Fix aa. The weight ⌊(b−1)/a⌋\lfloor(b-1)/a\rfloor is independent of kk, and as kk runs through the units modulo aa the residue k b2‾(a)k\,\overline{b^{2}}^{(a)} also runs through the units modulo aa. Therefore ∑1≤k<a(k,a)=1s(k b2‾(a),a)=∑u∈(Z/aZ)×s(u,a)=0\sum_{\substack{1\le k<a\\(k,a)=1}}s\bigl(k\,\overline{b^{2}}^{(a)},a\bigr)=\sum_{u\in(\mathbb{Z}/a\mathbb{Z})^{\times}}s(u,a)=0 by the reflection s(−u,a)=−s(u,a)s(-u,a)=-s(u,a). Multiplying by the kk-independent weight and summing over aa gives the claim. ◻

Lemma 27 (Dedekind first-moment bound). For k≥2k\ge 2, M1(k):=∑u∈(Z/kZ)×∣s(u,k)∣ ≪ k(log⁡k)2.M_1(k):=\sum_{u\in(\mathbb{Z}/k\mathbb{Z})^{\times}}|s(u,k)|\ \ll\ k(\log k)^{2}.

Proof. Use the cotangent formula [19] s(u,k)=14k∑n=1k−1cot⁡πnkcot⁡πnuk,s(u,k)=\frac1{4k}\sum_{n=1}^{k-1}\cot\frac{\pi n}{k}\cot\frac{\pi nu}{k}, and set C(k)=∑v=1k−1∣cot⁡(πv/k)∣C(k)=\sum_{v=1}^{k-1}|\cot(\pi v/k)|. Splitting the range at k/2k/2 and using ∣cot⁡x∣≪1/x|\cot x|\ll 1/x near 00 gives C(k)≪klog⁡kC(k)\ll k\log k. For fixed nn, put δ=(n,k)\delta=(n,k) and q=k/δq=k/\delta. As uu ranges over (Z/kZ)×(\mathbb{Z}/k\mathbb{Z})^{\times} the residues nu mod knu\bmod k are nonzero multiples δr\delta r with (r,q)=1(r,q)=1, each with multiplicity at most δ\delta, so ∑u∈(Z/kZ)×∣cot⁡πnuk∣ ≤ δ∑1≤r<q(r,q)=1∣cot⁡πrq∣ ≤ δ C(q) ≪ klog⁡k.\sum_{u\in(\mathbb{Z}/k\mathbb{Z})^{\times}}\Bigl|\cot\frac{\pi nu}{k}\Bigr|\ \le\ \delta\sum_{\substack{1\le r<q\\(r,q)=1}}\Bigl|\cot\frac{\pi r}{q}\Bigr|\ \le\ \delta\,C(q)\ \ll\ k\log k. Hence M1(k) ≤ 14k(∑n=1k−1∣cot⁡πnk∣)⋅O(klog⁡k) ≪ k(log⁡k)2.M_1(k)\ \le\ \frac1{4k}\Bigl(\sum_{n=1}^{k-1}\Bigl|\cot\frac{\pi n}{k}\Bigr|\Bigr)\cdot O(k\log k)\ \ll\ k(\log k)^{2}. ◻

Proposition 28 (kk-modulus remainder bound). Rb(k) ≪ b2(log⁡b)2.R_b^{(k)}\ \ll\ b^{2}(\log b)^{2}.

Proof. The k=1k=1 terms vanish. Fix k≥2k\ge 2, put β=b2 mod k\beta=b^{2}\bmod k, and define fk(a)=s(βa‾,k)f_k(a)=s(\beta\overline a,k) and g(a)=⌊(b−1)/a⌋g(a)=\lfloor(b-1)/a\rfloor. Since k<bk<b and bb is prime, β\beta is a unit modulo kk. The kk-slice of Rb(k)R_b^{(k)} is Tk=∑k<a≤b−1(a,k)=1g(a)fk(a).\mathcal T_k=\sum_{\substack{k<a\le b-1\\(a,k)=1}}g(a)f_k(a). The function fkf_k is periodic modulo kk, and over a complete reduced residue system its sum is zero, ∑ρ∈(Z/kZ)×fk(ρ)=∑us(u,k)=0\sum_{\rho\in(\mathbb{Z}/k\mathbb{Z})^{\times}}f_k(\rho)=\sum_{u}s(u,k)=0 by reflection. Therefore any interval of integers decomposes into complete periods, which contribute zero, and at most two incomplete periods. Hence every interval partial sum satisfies sup⁡I∣∑a∈I(a,k)=1fk(a)∣ ≤ 2M1(k).\sup_{I}\Bigl|\sum_{\substack{a\in I\\(a,k)=1}}f_k(a)\Bigr|\ \le\ 2M_1(k). Since gg is nonincreasing on a>ka>k, g(k+1)≪b/kg(k+1)\ll b/k, and its total variation on (k,b](k,b] is at most g(k+1)g(k+1), Abel summation gives ∣Tk∣≪bkM1(k).|\mathcal T_k|\ll \frac{b}{k}M_1(k). Using Lemma 27, ∣Tk∣≪b(log⁡k)2|\mathcal T_k|\ll b(\log k)^{2}. The definition of Rb(k)R_b^{(k)} contributes the fixed factor 88, and summing over 2≤k≤b−12\le k\le b-1 gives Rb(k) ≪ b∑k≤b(log⁡k)2 ≪ b2(log⁡b)2.R_b^{(k)}\ \ll\ b\sum_{k\le b}(\log k)^{2}\ \ll\ b^{2}(\log b)^{2}. ◻

Theorem 29 (Cubic law for digit-collision energy). For odd primes bb, Eb=b3+O ⁣(b2(log⁡b)2).E_b=b^{3}+O\!\left(b^{2}(\log b)^{2}\right). More precisely, Eb=13b3+23b3+O ⁣(b2(log⁡b)2),E_b=\frac13 b^{3}+\frac23 b^{3}+O\!\left(b^{2}(\log b)^{2}\right), where the first term is the diagonal pole and the second is the off-diagonal pole.

Proof. Proposition 23 together with Lemmas 24, 25, 26 and Proposition 28 gives Offb=23b3+O ⁣(b2(log⁡b)2).\mathrm{Off}_b=\frac23 b^{3}+O\!\left(b^{2}(\log b)^{2}\right). Adding the exact diagonal Δb=13b3+O(b2)\Delta_b=\tfrac13 b^{3}+O(b^{2}) from Proposition 20 proves the theorem. ◻

Remark 30 (Lower-order contributions). The asymptotic Eb∼b3E_b\sim b^{3} and the split 13+23\tfrac13+\tfrac23 are unconditional. The proof uses exact finite identities and Rademacher reciprocity. It then uses Σ=1\Sigma=1, Abel summation, and the first-moment bound in Lemma 27. The proved O(b2(log⁡b)2)O(b^2(\log b)^2) scale contains two discrete losses. One is the floor defect in the off-diagonal main term. The other is the surviving kk-modulus remainder. Determining the secondary term requires their combined contribution.

Remark 31 (Energy-pole interpretation). The word “pole” refers here to a cubic leading contribution. The diagonal is the ratio-one contribution k=uk=u, with the exact rational value in Proposition 20. The off-diagonal pairs the two orientations of every reduced ratio k≠uk\ne u. The cubic law gives Δbb3⟶13,Offbb3⟶23\frac{\Delta_b}{b^3}\longrightarrow\frac13, \qquad \frac{\mathrm{Off}_b}{b^3}\longrightarrow\frac23 as bb tends to infinity through odd primes. These limits do not assert a 1:21:2 ratio at a fixed base. The coprime Euler sum Σ=1\Sigma=1 fixes the off-diagonal leading constant.

Character-Moment Form

The Dedekind proof reads the energy additively. The primitive-character factorization gives a second exact reading. In the character basis, modular inversion becomes conjugation and the cubic law becomes a weighted moment of L(1,χ)L(1,\chi).

Proposition 32 rewrites the exact Bernoulli moment proved above in the short-window normalization supplied by Lemma 5. Inserting the cubic theorem gives the asymptotic below.

Proposition 32 (Character-moment form). For odd primes bb, with Sχ=∑w=1b−1χ(w)S_\chi=\sum_{w=1}^{b-1}\chi(w), Eb=4bπ2(b−1)∑χmodb2 primitiveχ(−1)=−1∣L(1,χ)∣2∣Sχ∣2.E_b=\frac{4b}{\pi^{2}(b-1)} \sum_{\substack{\chi\bmod b^{2}\ \mathrm{primitive}\\\chi(-1)=-1}} |L(1,\chi)|^{2}|S_\chi|^{2}.

Proof. Corollary 12 gives the corresponding moment in ∣B1,χ(b2)∣2\lvert B_{1,\chi}^{(b^2)}\rvert^2. For a primitive odd character modulo b2b^2, the functional equation and ∣τ(χ)∣=b\lvert\tau(\chi)\rvert=b give [12, 20] ∣B1,χ(b2)∣2=b2π2∣L(1,χ‾)∣2.\bigl|B_{1,\chi}^{(b^2)}\bigr|^2 =\frac{b^2}{\pi^2}|L(1,\overline\chi)|^2. Conjugation permutes the primitive odd characters and preserves ∣Sχ∣\lvert S_\chi\rvert. Since φ(b2)=b(b−1)\varphi(b^2)=b(b-1), the stated identity follows. ◻

Corollary 33 (L(1)L(1)-weighted window moment). For odd primes bb, ∑χmodb2 primitiveχ(−1)=−1∣L(1,χ)∣2∣Sχ∣2=π24(b−1)b2+O(b2(log⁡b)2).\sum_{\substack{\chi\bmod b^2\ \mathrm{primitive}\\\chi(-1)=-1}} |L(1,\chi)|^2|S_\chi|^2 =\frac{\pi^2}{4}(b-1)b^2+O\bigl(b^2(\log b)^2\bigr).

Proof. Proposition 32 gives ∑χmodb2 primitiveχ(−1)=−1∣L(1,χ)∣2∣Sχ∣2=π2(b−1)4b Eb.\sum_{\substack{\chi\bmod b^2\ \mathrm{primitive}\\\chi(-1)=-1}} |L(1,\chi)|^2|S_\chi|^2 =\frac{\pi^2(b-1)}{4b}\,E_b . Insert Theorem 29. ◻

Proposition 34 (Spectral pole split). Expanding ∣Sχ∣2=∑v,w=1b−1χ(v)χ‾(w)|S_\chi|^{2}=\sum_{v,w=1}^{b-1}\chi(v)\overline\chi(w) splits the spectral energy into a window diagonal v=wv=w and a window off-diagonal v≠wv\ne w. The diagonal contributes 13b3+O(b2)\tfrac13 b^{3}+O(b^{2}), while the off-diagonal contributes 23b3+O(b2(log⁡b)2)\tfrac23 b^{3}+O(b^{2}(\log b)^{2}).

Proof. The diagonal part is 4(b−1)φ(b2)∑χmodb2 primitiveχ(−1)=−1∣B1,χ(b2)∣2.\frac{4(b-1)}{\varphi(b^{2})} \sum_{\substack{\chi\bmod b^2\ {\rm primitive}\\ \chi(-1)=-1}} \bigl|B_{1,\chi}^{(b^2)}\bigr|^2 . The sawtooth expansion and character orthogonality identify the corresponding all-odd expression with 4(b−1)s~(1,b2)4(b-1)\widetilde s(1,b^2), where s~\widetilde s is the unit part of the Dedekind sum. The nonunit indices are a=jba=jb, so s~(1,b2)=s(1,b2)−s(1,b).\widetilde s(1,b^2)=s(1,b^2)-s(1,b). Since s(1,b)=O(b)s(1,b)=O(b), restoring these indices changes the diagonal by O(b2)O(b^2).

It remains to remove the odd characters induced from modulus bb. If χ\chi is induced from ψ mod b\psi\bmod b, then B1,χ(b2)=1b2∑r=1b−1∑t=0b−1(r+bt)ψ(r)=1b∑r=1b−1rψ(r)+b−12∑r=1b−1ψ(r)=B1,ψ(b).\begin{aligned} B_{1,\chi}^{(b^2)} &=\frac1{b^2}\sum_{r=1}^{b-1}\sum_{t=0}^{b-1}(r+bt)\psi(r)\\ &=\frac1b\sum_{r=1}^{b-1}r\psi(r) +\frac{b-1}{2}\sum_{r=1}^{b-1}\psi(r)\\ &=B_{1,\psi}^{(b)}. \end{aligned} The second sum vanishes because the odd character ψ\psi is nonprincipal. There are O(b)O(b) such characters and ∣B1,ψ(b)∣=O(b)\lvert B_{1,\psi}^{(b)}\rvert=O(b). Their total contribution is therefore 4(b−1)φ(b2) O(b3)=O(b2).\frac{4(b-1)}{\varphi(b^2)}\,O(b^3)=O(b^2). Finally, 4(b−1)s(1,b2)=(b−1)(b2−1)(b2−2)3b2=13b3+O(b2).4(b-1)s(1,b^{2}) =\frac{(b-1)(b^{2}-1)(b^{2}-2)}{3b^{2}} =\frac13 b^{3}+O(b^{2}). Thus the primitive spectral diagonal is 13b3+O(b2)\tfrac13b^3+O(b^2). Subtracting it from Theorem 29 gives the off-diagonal term. ◻

The Cubic Law

The starting observable is classical coordinate agreement. What changes here is the question asked of it. Instead of following one reciprocal orbit, the complete prime-square table collects every unit multiplier, centers each residue-class fiber, and measures the total square mass. Its finite boundary has a signed character flux. The primitive odd transform factors into that flux and a universal Bernoulli response, and Parseval returns the exact square mass.

At lag one in prime base, the same square mass is a centered carry-table variance and a weighted Dedekind average. Summing the collision ratios removes the Dedekind weight. The ratio-one diagonal is exact. Rademacher reciprocity pairs the off-diagonal ratios, and the coprime Euler sum fixes their leading constant. The result is Eb=4∑vmodb2(v,b)=1wb(v) s(v,b2)=b3+O ⁣(b2(log⁡b)2).E_b =4\sum_{\substack{v\bmod b^{2}\\(v,b)=1}}w_b(v)\,s(v,b^{2}) =b^{3}+O\!\left(b^{2}(\log b)^{2}\right). The continuous scale, the Dedekind machinery, and the L(1)L(1) machinery are classical. The finite conclusion is the exact collision-energy dictionary and the persistence of that scale on the complete prime-square carry table, with one third of the leading mass on the ratio-one diagonal and two thirds on the coprime off-diagonal. The same split appears in the primitive-character moment.

The floor defect and the surviving kk-modulus remainder determine the lower-order structure. Their combined coefficient requires a sharper estimate than the cubic theorem supplies. The leading constant, by contrast, is fixed completely by the exact ratio-one evaluation and the unit coprime Euler mass.

References

[1]T. M. Apostol, Modular Functions and Dirichlet Series in Number Theory, 2nd ed., Graduate Texts in Mathematics 41, Springer, New York, 1990.

[2]B. C. Berndt, Character analogues of the Poisson and Euler–Maclaurin summation formulas with applications, J. Number Theory 7 (1975), 413–445.

[3]S. Bettin and J. B. Conrey, Period functions and cotangent sums, Algebra Number Theory 7 (2013), no. 1, 215–242.

[4]B. Borda, M. Munsch, and I. E. Shparlinski, Pointwise and correlation bounds on Dedekind sums over small subgroups, Res. Number Theory 10 (2024), no. 2, article 28. doi:10.1007/s40993-024-00514-9.

[5]J. B. Conrey, E. Fransen, R. Klein, and C. Scott, Mean values of Dedekind sums, J. Number Theory 56 (1996), no. 2, 214–226.

[6]H. Davenport, Multiplicative Number Theory, 3rd ed., revised by H. L. Montgomery, Graduate Texts in Mathematics 74, Springer, New York, 2000.

[7]P. Flajolet and B. Salvy, Euler sums and contour integral representations, Experiment. Math. 7 (1998), no. 1, 15–35.

[8]K. Girstmair, The digits of 1/p1/p in connection with class number factors, Acta Arith. 67 (1994), no. 4, 381–386. https://doi.org/10.4064/aa-67-4-381-386

[9]K. Girstmair, Digit variance and Dedekind sums, J. Number Theory 65 (1997), no. 2, 197–205. https://doi.org/10.1006/jnth.1997.2149

[10]K. Girstmair, Mean values and variances of the digits of 1/p1/p, arXiv:2606.29930, 2026.

[11]T. Hilberdink, F. Luca, and L. Tóth, On certain sums concerning the gcd's and lcm's of kk positive integers, Int. J. Number Theory 16 (2020), no. 1, 77–90. https://doi.org/10.1142/S1793042120500049

[12]H. Iwaniec and E. Kowalski, Analytic Number Theory, American Mathematical Society Colloquium Publications 53, Amer. Math. Soc., Providence, RI, 2004.

[13]S. C. Kak and A. Chatterjee, On decimal sequences, IEEE Trans. Inform. Theory 27 (1981), no. 5, 647–652. https://doi.org/10.1109/TIT.1981.1056394

[14]A. Lempel and H. Greenberger, Families of sequences with optimal Hamming-correlation properties, IEEE Trans. Inform. Theory 20 (1974), no. 1, 90–94. https://doi.org/10.1109/TIT.1974.1055169

[15]S. R. Louboutin and M. Munsch, Mean square values of LL-functions over subgroups for nonprimitive characters, Dedekind sums and bounds on relative class numbers, Canad. J. Math. 75 (2023), no. 5, 1711–1743. https://doi.org/10.4153/S0008414X2300010X

[16]Paolo Minelli, Athanasios Sourmelidis, and Marc Technau, On restricted averages of Dedekind sums, Int. Math. Res. Not. IMRN (2024), no. 10, 8485–8502. doi:10.1093/imrn/rnad283.

[17]M. R. Murty and R. Thangadurai, The class number of Q(−p)\mathbb Q(\sqrt{-p}) and digits of 1/p1/p, Proc. Amer. Math. Soc. 139 (2011), no. 4, 1277–1289. https://doi.org/10.1090/S0002-9939-2010-10560-9

[18]H. Rademacher, Generalization of the reciprocity formula for Dedekind sums, Duke Math. J. 21 (1954), 391–397. doi:10.1215/S0012-7094-54-02140-7.

[19]H. Rademacher and E. Grosswald, Dedekind Sums, Carus Mathematical Monographs 16, Mathematical Association of America, Washington, DC, 1972.

[20]L. C. Washington, Introduction to Cyclotomic Fields, 2nd ed., Graduate Texts in Mathematics 83, Springer, New York, 1997.