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, 202210 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, and look only at their first decimal digits.

There are ten possible digits and twelve fractions. Most digits appear once. The digit 3 appears twice, from 4/134/134/13 and 5/135/135/13. The digit 6 appears twice, from 8/138/138/13 and 9/139/139/13.

Now do the same thing with the fifty-two fractions over 53. Every digit appears five times, except 3 and 6, which appear six times.

The extra places are in exactly the same columns.

Bin populations for primes 13 and 53, with the extra place at digits 3 and 6 highlighted in gold.
The tables grow, but the two extra places stay put. Both primes leave remainder 3 on division by ten.

That shared pattern is easy to see. What I want to know is how much it tells us about the digits that survive a multiplication. Does the last digit of the prime also tell us which comparisons will come out empty?

The answer has a useful boundary. The last digit fixes the pattern of larger bins. The actual matches require more information. A classical sum of Ramanujan gives an exact way to read those matches from the spectrum.

The extra places

A digit bin collects the remainders that produce the same first digit. At 13, the bin for digit 3 contains {4,5}\{4,5\}{4,5}. Both fractions begin with a 3. The bin for digit 6 contains {8,9}\{8,9\}{8,9}.

The bin sizes follow directly from dividing the prime by the base. Take a prime ppp that does not divide the base bbb, and write

p=bq+r.p=bq+r.p=bq+r.

Every bin has either qqq or q+1q+1q+1 remainders, and exactly r−1r-1r−1 bins have the extra place. The subtraction of one comes from leaving out the zero remainder. We are counting the fractions from 1/p1/p1/p to (p−1)/p(p-1)/p(p−1)/p.

For a fixed base, the remainder rrr determines which bins are larger. In decimal, the four possible endings of a prime other than 2 or 5 give four patterns.

Last digit of the prime Number of larger bins
1 0
3 2
7 6
9 8

A prime ending in 1 distributes its nonzero remainders evenly among the ten bins. A prime ending in 9 has an extra remainder in eight of them. These counts stay the same as the prime grows, although the bins themselves grow.

The continued fraction records the same remainder information in another form. For 13 and 53, division by ten gives 1+3/101+3/101+3/10 and 5+3/105+3/105+3/10. Their whole parts differ. Applying the Euclidean algorithm to the shared fraction gives the same continued-fraction tail, [3,3][3,3][3,3]. This is why the four decimal endings also produce four continued-fraction tails.

So far, we have only used division with remainder. The more interesting question begins when we move the remainders.

Multiply by two. Multiply by six.

Return to 13. Multiply every nonzero remainder by 2, reducing the result modulo 13. Then compare its digit with the digit it produced before the move.

The bin {4,5}\{4,5\}{4,5} goes to {8,10}\{8,10\}{8,10}. Neither result is still in the digit-3 bin. The bin {8,9}\{8,9\}{8,9} goes to {3,5}\{3,5\}{3,5}. Neither result is still in the digit-6 bin.

The other eight bins contain one remainder each. To stay in one of those bins, a remainder would have to return to itself. Doubling fixes no nonzero remainder modulo 13.

There are no matches anywhere.

Now multiply by 6. The remainder 5 goes to 4, since 6⋅5=306\cdot5=306⋅5=30 leaves remainder 4. Both produce digit 3. The remainder 8 goes to 9, and both produce digit 6. These are the only two matches.

The two nonsingleton bins modulo 13 under multiplication by 2 and 6. Doubling gives no returns; multiplication by 6 gives one return in each bin.
The bin may move almost entirely away from itself. A single returning remainder is enough to preserve a digit.

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

This question can be asked for every nonzero multiplier. It does not require the multiplier to be a power of the base. Powers of the base give the familiar cyclic shifts of a repetend. When the base is a primitive root, one repetend visits every nonzero remainder, so its shift counts are exactly these collision counts. Otherwise, the complete count covers more than one cycle.

Twelve, or minus one

In The Autocorrelation Formula, the digit-equality table was rewritten in frequency coordinates. Its transform, G(k,k′)G(k,k')G(k,k′), retains the information about which pairs of remainders produce equal digits. A multiplier picks out a line through this frequency table.

Ramanujan’s sum explains how that line can be selected using just two weights.

For a prime modulus ppp, the sum is called cp(t)c_p(t)cp​(t). It adds the rotating arrows associated with all the nonzero residues. If ttt is zero modulo ppp, all p−1p-1p−1 arrows point in the same direction and add to p−1p-1p−1. Otherwise, they run through all the pppth roots of unity except the arrow at 1. The complete set adds to zero. Leaving out that one arrow gives −1-1−1.

At 13, that means

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).​

These are the classical Ramanujan sums. Here they are applied to the combined frequency k+ak′k+ak'k+ak′. The exact collision identity is

C(a)=1p2∑k,k′G(k,k′) cp(k+ak′).C(a)=\frac{1}{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 indices run from 0 to p−1p-1p−1. Every entry of the frequency table receives a weight. The entries on the line k+ak′=0k+ak'=0k+ak′=0 receive p−1p-1p−1. Every other entry receives −1-1−1.

That second weight is essential. The off-line entries have not been individually set to zero.

The full table GGG sums to zero, because the original digit-equality table has zero at the omitted pair (0,0)(0,0)(0,0). If the selected line sums to SSS, the rest of the table therefore sums to −S-S−S. The two weights combine to give

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

After division by p2p^2p2, the collision count is S/pS/pS/p. The double sum has become a single line.

The Ramanujan selector modulo 13 for multiplier 6. Thirteen gold cells carry weight 12; all other cells carry weight minus one. Their weighted spectral total gives two matches.
The weights recover the same two matches we counted in the bins. Selection happens through the balance between the line and the rest of the spectrum.

At 13 with multiplier 6, the line sums to 26 and the remaining entries sum to −26-26−26. The weighted total is 12⋅26−(−26)=33812\cdot26-(-26)=33812⋅26−(−26)=338. Dividing by 132=16913^2=169132=169 gives 2.

There is no rounding in that answer. It counts the two remainders we already followed, 5→45\to45→4 and 8→98\to98→9.

How much survives

The line sum combines contributions from every digit bin and every frequency. Those contributions can reinforce or cancel one another.

To measure the cancellation, first take the magnitude of each contribution, before adding across bins or frequencies. This gives an unsigned total. Compare it with the magnitude of the sum after cancellation.

The resulting fraction is the phase-gate coefficient, Γ(a)\Gamma(a)Γ(a). A value of zero means complete cancellation. A value of one means all the unsigned mass survives.

The paper proves the bounds

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

The gate is zero exactly when the collision count is zero. At the identity multiplier, every remainder stays in place and the gate equals one.

For multiplier 6 at 13, the two matches give a lower bound of 2/12=1/62/12=1/62/12=1/6. The gate itself is about 0.1800.1800.180. For doubling, it is exactly zero.

There is also a precise limit to the gate metaphor. At a fixed prime, a positive count is at least one, so a positive gate is at least 1/(p−1)1/(p-1)1/(p−1). That bound shrinks as the prime grows. It does not give a universal gap separating zero from every positive gate at every prime.

The zero condition has a simpler description back in the bins. A multiplier closes the gate exactly when it moves every bin completely away from itself. Checking finite intersections and checking spectral cancellation give the same answer.

Back to 53

The opening tables had the same two larger bins. Doubling closed the gate at 13. Try it at 53.

The digit-0 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. At the other end of the table, the digit-9 bin contains {48,49,50,51,52}\{48,49,50,51,52\}{48,49,50,51,52}. Doubling modulo 53 keeps 51→4951\to4951→49 and 52→5152\to5152→51 inside that bin.

Those four returns are all the matches. The gate is open.

Thirteen and fifty-three share their last digit, their excess-bin pattern, and their continued-fraction tail. They disagree on whether doubling preserves a digit. The extra places stay in the same columns, but the growing bins admit moves that the smaller ones could not.

That is where the two parts of the calculation meet. Division with remainder tells us how the bins are built. Multiplication tests whether a remainder can stay inside one. Ramanujan’s two weights recover the answer in frequency coordinates, down to the same four returns.

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 →