Petty’s Notebook

Phase-Filtered Ramanujan Sums and the Spectral Gate

About this paperRepository PDFZenodo
Cite this paper

A. S. Petty, Phase-Filtered Ramanujan Sums and the Spectral Gate, DOI: 10.5281/zenodo.21850675.

Lean proofs

Abstract

Fix an integer base b≥2b\ge2 and a prime p∤bp\nmid b. The first base-bb digit partitions the nonzero residues modulo pp. Let KK mark pairs in the same digit bin, let GG be its two-dimensional Fourier transform, and let Cp,b(a)C_{p,b}(a) count the same-bin collisions between xx and axax. We prove the exact identity Cp,b(a)=1p2∑k,k′ mod pG(k,k′)cp(k+ak′),C_{p,b}(a) =\frac1{p^2}\sum_{k,k'\bmod p} G(k,k')c_p(k+ak'), where cpc_p is the classical Ramanujan sum. Its two values isolate the spectral line k+ak′=0k+ak'=0 and recover the collision formula. Thus the Ramanujan kernel enters the collision calculation exactly.

A normalized phase coefficient measures the spectral mass that survives cancellation. It lies between Cp,b(a)/(p−1)C_{p,b}(a)/(p-1) and 11, vanishes exactly when the collision count vanishes, and equals 11 at the identity. When bb is primitive modulo pp, these statements apply directly to repetend autocorrelation. Euclidean division p=bq+rp=bq+r gives the exact coarse bin word and the continued-fraction tail of p/bp/b. The remainder rr fixes both coarse objects, while the quotient and modulus remain visible in the full spectrum. The gate vanishes exactly when multiplication moves every digit bin away from itself, turning spectral cancellation into a finite disjointness problem.

April 2022 (revised September 2026)
2020 Mathematics Subject Classification: 11A63, 11B83, 42A16

The Two-Valued Selector

A prime Ramanujan sum takes only two values, yet those values can isolate one line from an entire two-dimensional spectrum. Applied to the digit partition of long division, the selected line counts exactly how many residues keep their digit under multiplication. A classical arithmetic kernel therefore becomes a finite gate for phase survival.

Long division puts two finite structures on the nonzero residues. Multiplication moves a residue through its orbit, while the first displayed digit places it in an interval. A collision occurs when the multiplication leaves that interval label unchanged.

Ramanujan sums and their Dirichlet series are classical  [2, 3]. Fourier inversion, orthogonality, Parseval’s identity, and finite-group line selection are standard  [5]. Cyclic digit matching is Hamming correlation  [6]. Kak and Chatterjee study Hamming distance between prime-reciprocal digit sequences and their cyclic shifts and also bound a numerical digit-product autocorrelation [7]. The equality count used here is Hamming correlation. The result here is the collision-specific assembly. A prime Ramanujan sum detects the linear relation between the two Fourier coordinates of the same-bin kernel. Combining its two values with the vanishing total spectrum leaves the exact spectral slice and hence the collision count. The normalized phase coefficient introduced below then measures how much unsigned spectral mass survives that cancellation.

For fixed n≥1n\ge1 and Re⁡(s)>1\operatorname{Re}(s)>1, one has ∑q=1∞cq(n)qs=σ1−s(n)ζ(s)\sum_{q=1}^{\infty}\frac{c_q(n)}{q^s} =\frac{\sigma_{1-s}(n)}{\zeta(s)} by the classical theory of Ramanujan and Hardy. Equation (1) gives the analytic context. In the collision identity below, the prime Ramanujan sum instead serves as a finite selector on a linear form in two frequency variables.

The Ramanujan Collision Identity

Let Fp\mathbb F_p be the field of residues modulo pp, represented by 0,1,…,p−10,1,\ldots,p-1, and put ep(t)=exp⁡ ⁣(2πitp).e_p(t)=\exp\!\left(\frac{2\pi i t}{p}\right). For x∈{1,…,p−1}x\in\{1,\ldots,p-1\} define the digit map δp,b(x)=⌊bxp⌋.\delta_{p,b}(x)=\left\lfloor\frac{bx}{p}\right\rfloor. For 0≤d<b0\le d<b, let Bd={x∈Fp∗∣δp,b(x)=d},fd=1Bd,B_d=\{x\in\mathbb F_p^*\mid \delta_{p,b}(x)=d\}, \qquad f_d=\mathbf 1_{B_d}, where each fdf_d is extended to Fp\mathbb F_p by fd(0)=0f_d(0)=0. Its additive Fourier transform is f^d(k)=∑x∈Fpfd(x)ep(−kx).\widehat f_d(k)=\sum_{x\in\mathbb F_p}f_d(x)e_p(-kx).

The same-bin kernel and its two-dimensional transform are K(x,y)=∑d=0b−1fd(x)fd(y)K(x,y)=\sum_{d=0}^{b-1}f_d(x)f_d(y) and G(k,k′)=∑x,y∈FpK(x,y)ep(−kx−k′y)=∑d=0b−1f^d(k)f^d(k′).G(k,k') =\sum_{x,y\in\mathbb F_p}K(x,y)e_p(-kx-k'y) =\sum_{d=0}^{b-1}\widehat f_d(k)\widehat f_d(k'). For a∈Fp∗a\in\mathbb F_p^* define the multiplicative collision count Cp,b(a)=∑x∈Fp∗K(x,ax)=∣{x∈Fp∗∣δp,b(x)=δp,b(ax)}∣.C_{p,b}(a) =\sum_{x\in\mathbb F_p^*}K(x,ax) =\bigl|\{x\in\mathbb F_p^*\mid \delta_{p,b}(x)=\delta_{p,b}(ax)\}\bigr|.

For m∈Fpm\in\mathbb F_p, the prime Ramanujan sum is cp(m)=∑x∈Fp∗ep(mx)={p−1m=0,−1m≠0.c_p(m)=\sum_{x\in\mathbb F_p^*}e_p(mx) = \begin{cases} p-1 & m=0,\\ -1 & m\ne0. \end{cases}

Theorem 1 (Ramanujan collision identity). For every a∈Fp∗a\in\mathbb F_p^*, Cp,b(a)=1p2∑k,k′∈FpG(k,k′)cp(k+ak′).C_{p,b}(a) =\frac1{p^2}\sum_{k,k'\in\mathbb F_p} G(k,k')c_p(k+ak').

Proof. Fourier inversion in both variables gives K(x,y)=1p2∑k,k′∈FpG(k,k′)ep(kx+k′y).K(x,y)=\frac1{p^2}\sum_{k,k'\in\mathbb F_p} G(k,k')e_p(kx+k'y). Set y=axy=ax and sum over x≠0x\ne0. The inner sum becomes ∑x∈Fp∗ep((k+ak′)x)=cp(k+ak′).\sum_{x\in\mathbb F_p^*}e_p\bigl((k+ak')x\bigr) =c_p(k+ak'). Substitution yields (4). ◻

Corollary 2 (Spectral slice). For every a∈Fp∗a\in\mathbb F_p^*, Cp,b(a)=1p∑k∈FpG(k,−a−1k).C_{p,b}(a) =\frac1p\sum_{k\in\mathbb F_p}G(k,-a^{-1}k).

Proof. Let S(a)=∑k+ak′=0G(k,k′).S(a)=\sum_{k+ak'=0}G(k,k'). Since K(0,0)=0K(0,0)=0, Fourier inversion at the origin gives T=∑k,k′∈FpG(k,k′)=p2K(0,0)=0.T=\sum_{k,k'\in\mathbb F_p}G(k,k')=p^2K(0,0)=0. The two values of cpc_p turn the numerator in (4) into (p−1)S(a)−(T−S(a))=pS(a).(p-1)S(a)-\bigl(T-S(a)\bigr)=pS(a). Division by p2p^2 gives Cp,b(a)=S(a)/pC_{p,b}(a)=S(a)/p. The relation k+ak′=0k+ak'=0 is equivalent to k′=−a−1kk'=-a^{-1}k. ◻

Theorem 1 is the precise Ramanujan connection. The kernel acts on the linear form k+ak′k+ak' in the full two-dimensional spectrum.

The slice formula also appears in The Autocorrelation Formula [1]. Here the two-valued Ramanujan selector supplies its derivation from the full spectrum.

The Phase Gate

Put Σp,b(a)=∑k∈FpG(k,−a−1k)\Sigma_{p,b}(a)=\sum_{k\in\mathbb F_p}G(k,-a^{-1}k) and Mp,b(a)=∑d=0b−1∑k∈Fp∣f^d(k)∣ ∣f^d(−a−1k)∣.M_{p,b}(a) =\sum_{d=0}^{b-1}\sum_{k\in\mathbb F_p} |\widehat f_d(k)|\,|\widehat f_d(-a^{-1}k)|.

Definition 3. The phase-gate coefficient is Γp,b(a)=∣Σp,b(a)∣Mp,b(a).\Gamma_{p,b}(a) =\frac{|\Sigma_{p,b}(a)|}{M_{p,b}(a)}.

The denominator is positive. Indeed, the term k=0k=0 contributes ∑d∣Bd∣2\sum_d|B_d|^2, and the bins partition p−1p-1 nonzero residues.

Theorem 4 (Exact gate bounds). For every a∈Fp∗a\in\mathbb F_p^*, Cp,b(a)p−1≤Γp,b(a)≤1.\frac{C_{p,b}(a)}{p-1} \le \Gamma_{p,b}(a)\le1. Moreover, Γp,b(a)=0⟺Cp,b(a)=0,\Gamma_{p,b}(a)=0 \quad\Longleftrightarrow\quad C_{p,b}(a)=0, and Γp,b(1)=1.\Gamma_{p,b}(1)=1. If Cp,b(a)>0C_{p,b}(a)>0, then Γp,b(a)≥1p−1.\Gamma_{p,b}(a)\ge\frac1{p-1}.

Proof. Corollary 2 gives Σp,b(a)=pCp,b(a).\Sigma_{p,b}(a)=pC_{p,b}(a). The triangle inequality gives ∣Σp,b(a)∣≤Mp,b(a)|\Sigma_{p,b}(a)|\le M_{p,b}(a).

For each digit dd, Cauchy–Schwarz and Parseval give ∑k∈Fp∣f^d(k)∣ ∣f^d(−a−1k)∣≤(∑k∣f^d(k)∣2)1/2(∑k∣f^d(−a−1k)∣2)1/2=p∣Bd∣.\begin{aligned} &\sum_{k\in\mathbb F_p} |\widehat f_d(k)|\,|\widehat f_d(-a^{-1}k)|\\ &\qquad\le \left(\sum_k|\widehat f_d(k)|^2\right)^{1/2} \left(\sum_k|\widehat f_d(-a^{-1}k)|^2\right)^{1/2} =p|B_d|. \end{aligned} Multiplication by −a−1-a^{-1} permutes the frequency indices. Summing over the bins yields Mp,b(a)≤p∑d∣Bd∣=p(p−1).M_{p,b}(a)\le p\sum_d|B_d|=p(p-1). Together with (7), this proves (6). It also proves the equivalence of the two zero conditions. A positive collision count is a positive integer, which gives the final lower bound.

When a=1a=1, the reality of fdf_d gives f^d(−k)=f^d(k)‾\widehat f_d(-k)=\overline{\widehat f_d(k)}. Hence Mp,b(1)=∑d,k∣f^d(k)∣2=p(p−1).M_{p,b}(1)=\sum_{d,k}|\widehat f_d(k)|^2=p(p-1). The identity map fixes every nonzero residue, so Cp,b(1)=p−1C_{p,b}(1)=p-1 and (7) gives the same value for Σp,b(1)\Sigma_{p,b}(1). ◻

The coefficient Γp,b(a)\Gamma_{p,b}(a) is the normalized fraction of unsigned spectral mass that survives cancellation along one slice. The spectral-slice identity ties that surviving mass exactly to the collision count. The lower bound for a positive gate is for fixed pp; it decreases with the modulus and gives no uniform positive gap over all primes.

Repetend Autocorrelation

Assume that bb is a primitive root modulo pp. The remainders in the long division of 1/p1/p are 1,b,b2,…,bp−2(modp).1,b,b^2,\ldots,b^{p-2}\pmod p. The corresponding digit word is dj=δp,b(bj mod p),0≤j<p−1.d_j=\delta_{p,b}(b^j\bmod p), \qquad 0\le j<p-1. For a cyclic lag ℓ∈Z/(p−1)Z\ell\in\mathbb Z/(p-1)\mathbb Z define Rp,b(ℓ)=∣{j mod (p−1)∣dj=dj+ℓ}∣.R_{p,b}(\ell) =\bigl|\{j\bmod(p-1)\mid d_j=d_{j+\ell}\}\bigr|.

Proposition 5 (Repetend specialization). If bb is primitive modulo pp, then Rp,b(ℓ)=Cp,b(bℓ).R_{p,b}(\ell)=C_{p,b}(b^\ell). Consequently, Rp,b(ℓ)=1p2∑k,k′∈FpG(k,k′)cp(k+bℓk′)=1p∑k∈FpG(k,−b−ℓk).R_{p,b}(\ell) =\frac1{p^2}\sum_{k,k'\in\mathbb F_p} G(k,k')c_p(k+b^\ell k') =\frac1p\sum_{k\in\mathbb F_p} G(k,-b^{-\ell}k). The phase-gate coefficient vanishes exactly at the zero autocorrelation lags.

Proof. As jj runs modulo p−1p-1, the residue x=bjx=b^j runs once through Fp∗\mathbb F_p^*. The equality dj=dj+ℓd_j=d_{j+\ell} is exactly δp,b(x)=δp,b(bℓx).\delta_{p,b}(x)=\delta_{p,b}(b^\ell x). The remaining statements follow from Theorems 1 and 4. ◻

Call pp digit-partitioning in base bb when δp,b\delta_{p,b} is injective on Fp∗\mathbb F_p^*.

Proposition 6 (Singleton bins). If pp is digit-partitioning in base bb, then G(k,k′)=cp(k+k′)G(k,k')=c_p(k+k') and Cp,b(a)={p−1a=1,0a≠1.C_{p,b}(a)= \begin{cases} p-1 & a=1,\\ 0 & a\ne1. \end{cases} If bb is also primitive modulo pp, then Rp,b(ℓ)=(p−1)1{ℓ=0}.R_{p,b}(\ell)=(p-1)\mathbf 1_{\{\ell=0\}}.

Proof. Injectivity makes every nonempty bin a singleton. Therefore K(x,y)=1{x=y≠0}K(x,y)=\mathbf 1_{\{x=y\ne0\}} and G(k,k′)=∑x∈Fp∗ep(−(k+k′)x)=cp(k+k′).G(k,k') =\sum_{x\in\mathbb F_p^*}e_p(-(k+k')x) =c_p(k+k'). The equality δp,b(x)=δp,b(ax)\delta_{p,b}(x)=\delta_{p,b}(ax) then holds exactly when x=axx=ax. Since x≠0x\ne0, this is equivalent to a=1a=1. Proposition 5 gives the autocorrelation formula. ◻

For singleton bins, the full transform is the Ramanujan kernel.

The Euclidean Bin Word

Write p=bq+r,1≤r<b.p=bq+r, \qquad 1\le r<b. The remainder is nonzero because p∤bp\nmid b. Put nd=∣Bd∣n_d=|B_d|.

Theorem 7 (Exact bin word). The bin sizes satisfy n0=qn_0=q and, for 1≤d<b1\le d<b, nd=q+⌈(d+1)rb⌉−⌈drb⌉.n_d =q+\left\lceil\frac{(d+1)r}{b}\right\rceil -\left\lceil\frac{dr}{b}\right\rceil. Define w0=0w_0=0 and wd=⌈(d+1)rb⌉−⌈drb⌉(1≤d<b).w_d =\left\lceil\frac{(d+1)r}{b}\right\rceil -\left\lceil\frac{dr}{b}\right\rceil \qquad (1\le d<b). Every wdw_d is 00 or 11, and exactly r−1r-1 entries are 11. Thus nd=q+wdn_d=q+w_d for every digit dd.

Proof. The condition δp,b(x)=d\delta_{p,b}(x)=d is equivalent to dpb≤x<(d+1)pb.\frac{dp}{b}\le x<\frac{(d+1)p}{b}. For d=0d=0, the positive integers in this interval are 1,…,q1,\ldots,q, so n0=qn_0=q. For 1≤d<b1\le d<b, the number of integers in the half-open interval is ⌈(d+1)pb⌉−⌈dpb⌉.\left\lceil\frac{(d+1)p}{b}\right\rceil -\left\lceil\frac{dp}{b}\right\rceil. Substitution of (8) gives (9). Since 0<r/b<10<r/b<1, each successive ceiling rises by either 00 or 11. The increments telescope to ∑d=1b−1wd=⌈brb⌉−⌈rb⌉=r−1.\sum_{d=1}^{b-1}w_d =\left\lceil\frac{br}{b}\right\rceil -\left\lceil\frac{r}{b}\right\rceil =r-1. ◻

The binary word (w0,…,wb−1)(w_0,\ldots,w_{b-1}) will be called the excess-bin word. It depends only on bb and the remainder rr. Different remainders give different words because the number of 11 entries is r−1r-1.

If the first entry is restored to 11, the word becomes w~d=⌈(d+1)rb⌉−⌈drb⌉,0≤d<b.\widetilde w_d =\left\lceil\frac{(d+1)r}{b}\right\rceil -\left\lceil\frac{dr}{b}\right\rceil, \qquad 0\le d<b. This is the rational upper mechanical word of slope r/br/b. Mechanical words, their Christoffel representatives, and their continued-fraction structure are classical [8]. The excess-bin word is the version left after the excluded zero residue removes the first rise.

Corollary 8 (Continued-fraction tail). Use the finite simple continued fraction whose final partial quotient is greater than 11. Then pb=[q,CF⁡ ⁣(br)].\frac pb =\left[q,\operatorname{CF}\!\left(\frac br\right)\right]. For a fixed base, the remainder rr determines both the continued-fraction tail and the excess-bin word.

Proof. Equation (8) gives pb=q+rb=q+1b/r.\frac pb=q+\frac rb=q+\frac1{b/r}. The Euclidean algorithm for b/rb/r supplies the remaining partial quotients [4]. ◻

In base 1010, primes different from 22 and 55 lie in four unit residue classes with the following coarse data.

The four coarse remainder classes in base 1010
r=p mod 10r=p\bmod10 continued-fraction tail excess bins
11 [10][10] 00
33 [3,3][3,3] 22
77 [1,2,3][1,2,3] 66
99 [1,9][1,9] 88

For a general base bb, every prime p∤bp\nmid b lies in one of the φ(b)\varphi(b) unit residue classes modulo bb. These classes label the coarse excess pattern; the quotient and modulus supply the remaining spectral data.

Corollary 9 (Zero-frequency mass). With p=bq+rp=bq+r, G(0,0)=bq2+(2q+1)(r−1).G(0,0) =bq^2+(2q+1)(r-1). Thus the quotient qq remains visible in the full spectrum.

Proof. Equation (2) and f^d(0)=nd\widehat f_d(0)=n_d give G(0,0)=∑d=0b−1nd2.G(0,0)=\sum_{d=0}^{b-1}n_d^2. Theorem 7 gives nd=q+wdn_d=q+w_d, with r−1r-1 entries of ww equal to 11. Expansion gives the displayed formula. The value changes with qq even when rr is fixed. ◻

The Euclidean remainder fixes the coarse excess pattern. The quotient and the modulus remain visible in the Fourier data. A continued-fraction tail organizes the first layer of the geometry; the phase gate retains the full quotient and modulus data.

Collision-Free Multipliers

The zero set of the phase gate has a direct combinatorial form.

Proposition 10 (Collision-free multipliers). For a∈Fp∗a\in\mathbb F_p^*, the following conditions are equivalent.

  1. Cp,b(a)=0C_{p,b}(a)=0.

  2. Γp,b(a)=0\Gamma_{p,b}(a)=0.

  3. aBd∩Bd=∅aB_d\cap B_d=\varnothing for every 0≤d<b0\le d<b.

Proof. The first two conditions are equivalent by Theorem 4. A contribution to Cp,b(a)C_{p,b}(a) is exactly a residue x∈Bdx\in B_d for which ax∈Bdax\in B_d. Such a residue exists exactly when aBd∩BdaB_d\cap B_d is nonempty for some dd. ◻

This converts spectral cancellation into a finite disjointness problem.

The Finite Boundary of the Gate

The collision count is a line selected from a two-dimensional spectrum. The prime Ramanujan sum performs that selection exactly. The vanishing total spectrum makes the weighted combination of the line and its complement equal to pp times the line sum. Normalizing the surviving mass by the unsigned phase mass gives the phase gate.

The Euclidean division p=bq+rp=bq+r supplies a second exact layer. The remainder fixes the excess-bin word and the continued-fraction tail, while the quotient remains visible even at zero frequency. Together they separate the coarse Euclidean label from the full phase data.

The boundary is concrete. For fixed bb and pp, determine the multipliers that move every digit bin away from itself.

References

[1]A. S. Petty, The Autocorrelation Formula, January 2022. https://doi.org/10.5281/zenodo.21850316.

[2]S. Ramanujan, On certain trigonometrical sums and their applications in the theory of numbers, Trans. Cambridge Philos. Soc. 22 (1918), 259–276.

[3]G. H. Hardy, Note on Ramanujan's trigonometrical function cq(n)c_q(n) and certain series of arithmetical functions, Proc. Cambridge Philos. Soc. 20 (1921), 263–271.

[4]A. Ya. Khinchin, Continued Fractions, Dover, 1997.

[5]A. Terras, Fourier Analysis on Finite Groups and Applications, Cambridge University Press, 1999.

[6]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.

[7]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.

[8]M. Lothaire, Algebraic Combinatorics on Words, Encyclopedia of Mathematics and its Applications, vol. 90, Cambridge University Press, 2002.