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

Phase-Filtered Ramanujan Sums and the Spectral Gate

April 17, 202213 min read
Companion paper: Phase-Filtered Ramanujan Sums and the Spectral Gate →
Orange waves pass through bright vertical lines and emerge as blue and violet waves against a dark background.
A digit match in the remainder table is surviving mass in the spectrum. Ramanujan’s sum connects the two.

Write the twelve fractions from 1/131/131/13 through 12/1312/1312/13. Read their first decimal digits.

Ten digits, twelve fractions. Most digits appear once. Three appears twice, from 4/134/134/13 and 5/135/135/13. Six appears twice, from 8/138/138/13 and 9/139/139/13.

Now use the fifty-two fractions over 53. Every digit appears five times, except three and six, which appear six times.

The extra places stay in the same columns.

Decimal bin populations at thirteen and fifty-three. Teal bars show one place per bin at thirteen and five at fifty-three. Gold adds one place at digits three and six in both tables. Decimal bin populations at thirteen and fifty-three. Teal bars show one place per bin at thirteen and five at fifty-three. Gold adds one place at digits three and six in both tables.
The gold additions occupy the same two columns. The teal part grows from one to five places in each bin.

Both primes end in three. That ending fixes where the extra places go. I want to know whether it also fixes which digit comparisons come out empty.

Keep the two tables. We can test that question by multiplying their remainders.

The extra places

A digit bin collects remainders that emit the same first digit. At thirteen, the digit-three bin is {4,5}\{4,5\}{4,5} and the digit-six bin is {8,9}\{8,9\}{8,9}.

For a prime ppp not dividing the base b≥2b\ge2b≥2, write

p=bq+r,1≤r<b.p=bq+r,\qquad 1\le r<b.p=bq+r,1≤r<b.

Every bin has qqq or q+1q+1q+1 members. Exactly r−1r-1r−1 bins get the extra member. We lose one of the rrr extra places because remainder zero is excluded. Digit zero is not excluded. At fifty-three, five fractions begin with it.

The remainder rrr determines which bins are larger. In decimal, primes other than two and five give four possibilities.

Last digit of the prime Larger bins
1 None
3 Two
7 Six
9 Eight

The quotient grows. The pattern of extra places does not.

Multiply by two. Multiply by six.

Return to thirteen. Double each nonzero remainder, reduce modulo thirteen, and compare its digit before and after the move.

The bin {4,5}\{4,5\}{4,5} goes to {8,10}\{8,10\}{8,10}. Neither result remains in the digit-three bin. The bin {8,9}\{8,9\}{8,9} goes to {3,5}\{3,5\}{3,5}. Neither remains in the digit-six bin.

The other eight bins are singletons. A remainder could keep its digit there only by returning to itself. Doubling fixes no nonzero remainder modulo thirteen.

No matches anywhere.

Now multiply by six. Five goes to four, since 6⋅5=306\cdot5=306⋅5=30 leaves remainder four. Both emit three. Eight goes to nine. Both emit six.

Remainders four, five, eight and nine modulo thirteen under multiplication by two and by six. Doubling changes every digit. Multiplication by six keeps five to four in digit three and eight to nine in digit six. The surviving pairs are gold. Remainders four, five, eight and nine modulo thirteen under multiplication by two and by six. Doubling changes every digit. Multiplication by six keeps five to four in digit three and eight to nine in digit six. The surviving pairs are gold.
The four members of the two nonsingleton bins, followed one at a time. Gold marks the only two same-digit moves. Neither multiplier can fix a member of a singleton bin.

Call the number of matches C(a)C(a)C(a), where aaa is the multiplier. We have counted C(2)=0C(2)=0C(2)=0 and C(6)=2C(6)=2C(6)=2.

These counts use every nonzero remainder. A multiplier need not be a power of the base. When it is, the count adds the corresponding shifted matches across all remainder cycles. Only in the full-period case does one repetend supply the whole count.

Twelve, or minus one

The Autocorrelation Formula puts digit equality in a square table KKK. A cell is one when its two remainders emit the same digit. The zero row and column stay empty. Its Fourier transform G(k,k′)G(k,k')G(k,k′) gives the same information in frequency coordinates.

A line through GGG recovers C(a)C(a)C(a). Ramanujan’s sum supplies another way to select that line, with two weights and a balance.

For a prime ppp, the sum cp(t)c_p(t)cp​(t) adds the unit arrows associated with all nonzero residues. When t=0t=0t=0 modulo ppp, all p−1p-1p−1 arrows point together. Otherwise they form every pppth root of unity except the arrow at one. The complete set sums to zero. Leaving out that arrow gives minus one.

At thirteen,

c13(t)={12,t=0(mod13),−1,t≠0(mod13).c_{13}(t)=\begin{cases}12,&t=0\pmod{13},\\-1,&t\ne0\pmod{13}.\end{cases}c13​(t)={12,−1,​t=0(mod13),t=0(mod13).​

This is the classical sum studied in Ramanujan’s 1918 paper. Here its argument is the combined frequency k+ak′k+ak'k+ak′. The collision identity is

C(a)=1p2∑k,k′G(k,k′)cp(k+ak′).C(a)=\frac1{p^2}\sum_{k,k'}G(k,k')c_p(k+ak').C(a)=p21​k,k′∑​G(k,k′)cp​(k+ak′).

Both frequency labels run from zero to p−1p-1p−1. The line k+ak′=0k+ak'=0k+ak′=0 receives weight p−1p-1p−1. Every other cell receives minus one.

The off-line cells have not been erased.

The transform and the collision identity

Let BdB_dBd​ be the bin for digit ddd, and let fdf_dfd​ be its indicator, with fd(0)=0f_d(0)=0fd​(0)=0. Its Fourier coefficient is the sum of the bin’s rotating arrows,

f^d(k)=∑x∈Bde−2πikx/p.\widehat f_d(k)=\sum_{x\in B_d}e^{-2\pi i kx/p}.f​d​(k)=x∈Bd​∑​e−2πikx/p.

The equality table and its 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),K(x,y)=d=0∑b−1​fd​(x)fd​(y), G(k,k′)=∑d=0b−1f^d(k)f^d(k′).G(k,k')=\sum_{d=0}^{b-1}\widehat f_d(k)\widehat f_d(k').G(k,k′)=d=0∑b−1​f​d​(k)f​d​(k′).

There is no conjugate in the second product. Fourier inversion gives

K(x,y)=1p2∑k,k′G(k,k′)e2πi(kx+k′y)/p.K(x,y)=\frac1{p^2}\sum_{k,k'}G(k,k')e^{2\pi i(kx+k'y)/p}.K(x,y)=p21​k,k′∑​G(k,k′)e2πi(kx+k′y)/p.

Set y=axy=axy=ax and sum over nonzero xxx. Each exponential becomes part of

∑x=1p−1e2πi(k+ak′)x/p=cp(k+ak′).\sum_{x=1}^{p-1}e^{2\pi i(k+ak')x/p}=c_p(k+ak').x=1∑p−1​e2πi(k+ak′)x/p=cp​(k+ak′).

The left side counts remainders that retain their digit. The right side is the Ramanujan-weighted collision identity. It holds for every nonzero multiplier, without a primitive-root assumption.

The full table GGG sums to zero, because Fourier inversion gives ∑k,k′G(k,k′)=p2K(0,0)=0\sum_{k,k'}G(k,k')=p^2K(0,0)=0∑k,k′​G(k,k′)=p2K(0,0)=0. If the selected line sums to SSS, the rest of the table sums to −S-S−S. Apply the two weights,

(p−1)S−(−S)=pS.(p-1)S-(-S)=pS.(p−1)S−(−S)=pS.

Divide by p2p^2p2. The answer is S/pS/pS/p. The double sum has become a single line.

A thirteen-by-thirteen table of Ramanujan weights for multiplier six. Gold cells on k plus six k prime equals zero carry twelve. Every other cell carries minus one. The spectral sum on the line is 26 and off the line minus 26. Their weighted total 338 divided by 169 gives two matches. A thirteen-by-thirteen table of Ramanujan weights for multiplier six. Gold cells on k plus six k prime equals zero carry twelve. Every other cell carries minus one. The spectral sum on the line is 26 and off the line minus 26. Their weighted total 338 divided by 169 gives two matches.
The numbers inside the grid are weights, not entries of the cross-spectrum. Every cell contributes. The line and its complement balance to zero before the weights are applied.

At thirteen with multiplier six, the line sums to 26. The remaining cells sum to −26-26−26. Their weighted total is 12⋅26−(−26)=33812\cdot26-(-26)=33812⋅26−(−26)=338. Divide by 132=16913^2=169132=169 and the answer is two.

There is no rounding in that answer. It counts 5→45\to45→4 and 8→98\to98→9.

Twenty-six survives

The selected line adds contributions from all the digit bins. Each contribution has a magnitude and a phase. Adding them can lose much of the magnitude to cancellation.

To measure that loss, take the magnitude of each bin contribution before adding across bins or frequencies. Call the unsigned total M(a)M(a)M(a). With k′=−a−1kk'=-a^{-1}kk′=−a−1k along the selected line,

M(a)=∑d,k∣f^d(k)∣ ∣f^d(−a−1k)∣.M(a)=\sum_{d,k}|\widehat f_d(k)|\,|\widehat f_d(-a^{-1}k)|.M(a)=d,k∑​∣f​d​(k)∣∣f​d​(−a−1k)∣.

The sum after cancellation is S(a)=pC(a)S(a)=pC(a)S(a)=pC(a). Define the phase-gate coefficient by

Γ(a)=∣S(a)∣M(a)=pC(a)M(a).\Gamma(a)=\frac{|S(a)|}{M(a)}=\frac{pC(a)}{M(a)}.Γ(a)=M(a)∣S(a)∣​=M(a)pC(a)​.

The order of operations is essential. Taking ∣G(k,k′)∣|G(k,k')|∣G(k,k′)∣ after its bins have already been added would miss cancellation between bins and give a different denominator.

At thirteen, multiplier six selects k′=2kk'=2kk′=2k. Its unsigned total is 144.5895015…144.5895015\ldots144.5895015…. The signed sum is exactly 26.

Thirteen frequencies at denominator thirteen, multiplier six. Teal bars show unsigned bin contributions before adding across bins. Gold dots and stems show the signed entries after adding bins on the selected line. Unsigned mass totals 144.5895015, while the signed sum is exactly 26, giving gate approximately 0.1798194. Thirteen frequencies at denominator thirteen, multiplier six. Teal bars show unsigned bin contributions before adding across bins. Gold dots and stems show the signed entries after adding bins on the selected line. Unsigned mass totals 144.5895015, while the signed sum is exactly 26, giving gate approximately 0.1798194.
Magnitudes are taken before adding the bins. The teal bars retain that unsigned total; the gold values include cancellation. Their ratio gives the gate. The plotted Fourier values are numerical evaluations checked against the exact count of two.

Thus Γ(6)=0.1798194…\Gamma(6)=0.1798194\ldotsΓ(6)=0.1798194…. About eighteen percent of the unsigned mass survives. That is not the fraction of remainders that match, which is 2/122/122/12.

Work out the unsigned total at thirteen

Each singleton bin supplies a Fourier coefficient of magnitude one at every frequency. Eight such bins and thirteen frequencies contribute 8⋅13=1048\cdot13=1048⋅13=104 to M(6)M(6)M(6).

Each two-member bin contains neighbors. Their unit arrows differ in angle by 2πk/132\pi k/132πk/13, so the sum has magnitude 2∣cos⁡(πk/13)∣2|\cos(\pi k/13)|2∣cos(πk/13)∣. Along k′=2kk'=2kk′=2k, the product of the two magnitudes is 4∣cos⁡(πk/13)cos⁡(2πk/13)∣4|\cos(\pi k/13)\cos(2\pi k/13)|4∣cos(πk/13)cos(2πk/13)∣. Both two-member bins contribute the same amount.

Put

tk=∣cos⁡πk13cos⁡2πk13∣.t_k=\left|\cos\frac{\pi k}{13}\cos\frac{2\pi k}{13}\right|.tk​=​cos13πk​cos132πk​​. M(6)=104+8∑k=012tk.M(6)=104+8\sum_{k=0}^{12}t_k.M(6)=104+8k=0∑12​tk​.

The terms satisfy t13−k=tkt_{13-k}=t_kt13−k​=tk​. These seven values give the entire sum. The displayed decimals are rounded.

kkk tkt_ktk​
0 1.000000000
1 0.859726283
2 0.502996353
3 0.090223001
4 0.201438535
5 0.265425569
6 0.117034103

Count t0t_0t0​ once and each of the other six twice. Their sum is 5.073687689…5.073687689\ldots5.073687689…, giving

M(6)=144.589501512…,M(6)=144.589501512\ldots,M(6)=144.589501512…, Γ(6)=26144.589501512….\Gamma(6)=\frac{26}{144.589501512\ldots}.Γ(6)=144.589501512…26​.

Only the decimal evaluation is approximate. The finite cosine sum specifies the denominator exactly.

Zero means no returns

The gate lies between two bounds,

C(a)p−1≤Γ(a)≤1.\frac{C(a)}{p-1}\le\Gamma(a)\le1.p−1C(a)​≤Γ(a)≤1.

Its denominator is always positive. The zero-frequency terms alone contribute the sum of the squared bin sizes. The gate therefore vanishes exactly when C(a)C(a)C(a) does.

At the identity multiplier, nothing moves and the gate is one. At thirteen, doubling makes it zero. Multiplication by six puts it just above the lower bound 1/61/61/6.

Phase-gate values for every nonzero multiplier at thirteen and fifty-three. Gold points show the gate and teal points the normalized collision lower bound. Hollow gold points at zero represent exact zero counts. The identity multiplier has gate one in both panels. Phase-gate values for every nonzero multiplier at thirteen and fifty-three. Gold points show the gate and teal points the normalized collision lower bound. Hollow gold points at zero represent exact zero counts. The identity multiplier has gate one in both panels.
One point per multiplier, in numerical order. Gold never falls below the teal lower bound. The zero markers come from exact integer counts, not rounded Fourier values. The panels have different multiplier ranges.

A zero has a literal meaning in the bins. Every bin moves completely away from itself. If even one remainder stays inside its bin, the gate is positive.

Why the bounds hold

The triangle inequality gives ∣S(a)∣≤M(a)|S(a)|\le M(a)∣S(a)∣≤M(a). This is the upper bound.

For the lower bound, multiplication by −a−1-a^{-1}−a−1 permutes the frequency labels. Cauchy–Schwarz and Parseval give, bin by bin,

∑k∣f^d(k)∣ ∣f^d(−a−1k)∣≤p∣Bd∣.\sum_k|\widehat f_d(k)|\,|\widehat f_d(-a^{-1}k)|\le p|B_d|.k∑​∣f​d​(k)∣∣f​d​(−a−1k)∣≤p∣Bd​∣.

Adding over bins yields M(a)≤p(p−1)M(a)\le p(p-1)M(a)≤p(p−1). Since S(a)=pC(a)S(a)=pC(a)S(a)=pC(a), division gives Γ(a)≥C(a)/(p−1)\Gamma(a)\ge C(a)/(p-1)Γ(a)≥C(a)/(p−1).

When a=1a=1a=1, opposite-frequency coefficients are conjugates. Every product is a nonnegative squared magnitude. No cancellation occurs, so Γ(1)=1\Gamma(1)=1Γ(1)=1.

A positive collision count is an integer at least one. Hence a positive gate is at least 1/(p−1)1/(p-1)1/(p−1) at a fixed prime. That bound shrinks as ppp grows. It supplies no uniform positive gap over all primes.

The companion paper, Phase-Filtered Ramanujan Sums and the Spectral Gate, gives the complete proofs and the Euclidean bin formula.

Four returns at fifty-three

Doubling leaves no return at thirteen. Try the same multiplier at fifty-three.

The digit-zero bin now contains {1,2,3,4,5}\{1,2,3,4,5\}{1,2,3,4,5}. Doubling keeps 1→21\to21→2 and 2→42\to42→4 inside it. The digit-nine bin contains {48,49,50,51,52}\{48,49,50,51,52\}{48,49,50,51,52}. Doubling modulo fifty-three keeps 51→4951\to4951→49 and 52→5152\to5152→51 inside that bin.

The two endpoint digit bins at fifty-three under doubling. Bin zero contains one through five and keeps one to two and two to four. Bin nine contains 48 through 52 and keeps 51 to 49 and 52 to 51. The four returns are gold. The two endpoint digit bins at fifty-three under doubling. Bin zero contains one through five and keeps one to two and two to four. Bin nine contains 48 through 52 and keeps 51 to 49 and 52 to 51. The four returns are gold.
All four returns belong to the endpoint bins. Neither bin receives one of the extra places at digits three and six.

Those are all four matches. The same Ramanujan calculation gives a line sum of 53⋅4=21253\cdot4=21253⋅4=212 and recovers C(2)=4C(2)=4C(2)=4. The gate is positive.

Six primes with the same two extra places

Every prime below ends in three. Every one has its extra places at digits three and six. The pictures show actual returns, one cell per remainder and multiplier.

Six integer collision tables for decimal primes thirteen, 43, 53, 103, 223 and 503. Columns are nonzero remainders and rows are nonzero multipliers. Colored cells mark equal first digits before and after multiplication. Ten colors identify the retained digit. Uncolored cells mark no match. Six integer collision tables for decimal primes thirteen, 43, 53, 103, 223 and 503. Columns are nonzero remainders and rows are nonzero multipliers. Colored cells mark equal first digits before and after multiplication. Ten colors identify the retained digit. Uncolored cells mark no match.
All six primes end in three. All have the same two extra-bin positions. Color identifies the digit that survives; it is not frequency power or gate magnitude. Every cell is retained, including the fully filled identity row. Open the plate to inspect the larger tables.

Read a row to see which remainders keep their digit under one multiplication. Its number of colored cells is C(a)C(a)C(a). An empty row means a zero gate. The bottom row is the identity, so it is completely filled.

These are integer comparisons in the remainder table, not frequency plots. Color names the retained digit, with one key shared by all six panels. The largest table has 5022=252,004502^2=252{,}0045022=252,004 cells. All are retained in the full-size plate. Each row count is also checked against its Fourier slice and phase-gate bounds.

The bins, the moves, and the selector

These wider plates put the two bin populations alongside their multiplication tests and the Ramanujan weights. The selector’s gold cells carry twelve, not the spectral values being weighted.

Bin populations at thirteen and fifty-three. The two gold additions stay at digits three and six while the common part of each bin grows.
Bin populations at thirteen and fifty-three. The two gold additions stay at digits three and six while the common part of each bin grows.
The two nonsingleton bins at thirteen under multiplication by two and six. The intersections isolate the two returns under six.
The two nonsingleton bins at thirteen under multiplication by two and six. The intersections isolate the two returns under six.
The Ramanujan selector at thirteen for multiplier six, with its line and off-line spectral totals shown alongside. Weighting both parts gives exactly two matches.
The Ramanujan selector at thirteen for multiplier six, with its line and off-line spectral totals shown alongside. Weighting both parts gives exactly two matches.

The extra places are still at three and six. None of the four returns uses either bin.

They occur at zero and nine, where the smaller table had no room for them.

Companion paper: Phase-Filtered Ramanujan Sums and the Spectral Gate →
Share

Discussion

Sign in to join the discussion.

← All articlesRead the paper →
← Previous: The Autocorrelation Formula
Next: Bin Derangements and the Gate Width Theorem →