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

The Spectral Power of the Digit Function

October 26, 202115 min read
Companion paper: The Spectral Power of the Digit Function →
The Spectral Power of the Digit Function
The lengths of the digit bins determine a spectrum. Sliding the bins reveals the count behind it.

Divide each of the numbers from one through twelve by thirteen. Read just the first decimal digit.

Two fractions begin with a three. Two begin with a six. Every other digit occurs once.

First digit Numerators that produce it
0 1
1 2
2 3
3 4, 5
4 6
5 7
6 8, 9
7 10
8 11
9 12

These groups are the digit bins. Eight contain one numerator. Two contain a pair. The pair in the three-bin is 4 and 5. The pair in the six-bin is 8 and 9. Both pairs are neighbors.

I want to keep that small observation in view. The frequency curve we are about to draw can be accounted for by those four numbers.

This time we move through the remainders by addition. The matrix spectrum in The Spectral Structure of Fractional Fields follows multiplication by the base. The bins are the same starting material, but the move is different. The power below is not a list of that matrix’s eigenvalues.

Slide the bins

Start with the bin {4,5}\{4,5\}{4,5}. Add one to each remainder and count how many stay in the bin.

Four moves to five and stays. Five moves to six and leaves. There is one match. Add two instead and both leave. With no shift, both stay.

The fixed decimal digit-three bin at thirteen contains remainders four and five. Triangle markers locate those remainders after shifts zero, one, and two. Two, one, and zero markers respectively remain inside the teal bin cells. The fixed decimal digit-three bin at thirteen contains remainders four and five. Triangle markers locate those remainders after shifts zero, one, and two. Two, one, and zero markers respectively remain inside the teal bin cells.
The cells mark the original bin. The triangles mark the shifted remainders, gold if they stay inside and gray if they leave. A one-step shift keeps one match; a two-step shift keeps none. Select any figure for full-size inspection.

The bin {8,9}\{8,9\}{8,9} behaves the same way. Each singleton loses its only match as soon as we shift it by a nonzero amount modulo thirteen.

Now add the counts from all the bins. At shift zero, all twelve remainders match themselves. At shift one, 4 moves to 5 and 8 moves to 9. Two matches. Shift backward and the same pairs match in reverse. Every other shift gives zero.

Shifts wrap around modulo thirteen. Passing twelve takes us to zero and then one. Remainder zero is omitted from the table and contributes no match. That does not remove the digit-zero bin, which contains remainder one.

These counts form the additive collision profile.

Two arrows

Give each remainder an arrow of length one. At frequency one, the arrow turns by one thirteenth of a full turn as we move from one remainder to the next. At frequency six, it turns by six thirteenths, almost half a turn.

Within each bin, add the arrows. Two arrows pointing nearly the same way reinforce one another. Two pointing nearly opposite ways almost cancel.

Two unit arrows for neighboring remainders at frequencies one and six modulo thirteen. At frequency one their resultant length is about 1.942 and power 3.771. At frequency six the length is about 0.241 and power 0.058. Gold marks each resultant. Two unit arrows for neighboring remainders at frequencies one and six modulo thirteen. At frequency one their resultant length is about 1.942 and power 3.771. At frequency six the length is about 0.241 and power 0.058. Gold marks each resultant.
The same two neighbors contribute nearly four units of power at frequency one and almost none at frequency six. The arrows are rotated together on the page, preserving their separation and the length of their sum.

Square the length of each bin’s sum, then add those squared lengths across the bins. This is the spectral power, written Φ(k)\Phi(k)Φ(k) at frequency kkk.

A singleton contributes one at every frequency. There is nothing for its arrow to cancel against. At thirteen, the eight singletons supply a constant eight. Each neighboring pair has squared sum length 4cos⁡2(πk/13)4\cos^2(\pi k/13)4cos2(πk/13). Two pairs give

Φ(k)=8+8cos⁡2(πk13).\Phi(k)=8+8\cos^2\left(\frac{\pi k}{13}\right).Φ(k)=8+8cos2(13πk​).

At frequency zero, every arrow points the same way. Each pair has sum length two and contributes four. The total is 8+4+4=168+4+4=168+4+4=16. Near the middle frequencies, the pairs almost cancel and the total falls close to eight. The singleton contributions cannot disappear.

The count inside the curve

The same formula can be written

Φ(k)=12+4cos⁡(2πk13).\Phi(k)=12+4\cos\left(\frac{2\pi k}{13}\right).Φ(k)=12+4cos(132πk​).

Now the shift count is visible inside it. Twelve self-matches supply the constant term. Two forward matches and two backward matches supply the cosine.

At thirteen in decimal, the additive collision counts are twelve at shift zero, two at shifts plus and minus one, and zero elsewhere. Below, thirteen spectral power samples have a constant teal contribution of eight plus a changing gold contribution from the two paired bins. At thirteen in decimal, the additive collision counts are twelve at shift zero, two at shifts plus and minus one, and zero elsewhere. Below, thirteen spectral power samples have a constant teal contribution of eight plus a changing gold contribution from the two paired bins.
Above, the count by shift. Below, its Fourier power at the thirteen integer frequencies. The power is also the sum of eight singleton contributions and two pair contributions. Lines connect the discrete samples as a reading guide.

The Fourier transform takes the shift counts to these power values. Its inverse recovers the count at every shift. It does not recover which remainders made the matches. For the names 4, 5, 8, and 9, we return to the table.

The transform, with its normalization

For a prime ppp not dividing the base bbb, the digit function is δ(r)=⌊br/p⌋\delta(r)=\lfloor br/p\rfloorδ(r)=⌊br/p⌋, with 1≤r<p1\le r<p1≤r<p. Let BdB_dBd​ be the bin for digit ddd, and set every bin indicator to zero at remainder zero.

The bin coefficient and total power are

1^Bd(k)=∑r∈Bde−2πikr/p,\widehat{\mathbf1}_{B_d}(k)=\sum_{r\in B_d}e^{-2\pi i kr/p},1Bd​​(k)=r∈Bd​∑​e−2πikr/p, Φ(k)=∑d=0b−1∣1^Bd(k)∣2.\Phi(k)=\sum_{d=0}^{b-1}|\widehat{\mathbf1}_{B_d}(k)|^2.Φ(k)=d=0∑b−1​∣1Bd​​(k)∣2.

Let Cadd(h)C_{\mathrm{add}}(h)Cadd​(h) count remainders that stay in their digit bin after addition of hhh modulo ppp. Then

Φ(k)=∑h=0p−1Cadd(h)e−2πikh/p,\Phi(k)=\sum_{h=0}^{p-1}C_{\mathrm{add}}(h)e^{-2\pi i kh/p},Φ(k)=h=0∑p−1​Cadd​(h)e−2πikh/p, Cadd(h)=1p∑k=0p−1Φ(k)e2πikh/p.C_{\mathrm{add}}(h)=\frac1p\sum_{k=0}^{p-1}\Phi(k)e^{2\pi i kh/p}.Cadd​(h)=p1​k=0∑p−1​Φ(k)e2πikh/p.

The forward transform is unnormalized. The inverse divides by ppp. These are additive frequencies of the residue coordinate, not frequencies around a multiplication cycle.

Only the endpoints survive

A longer consecutive bin gives more arrows, each turned by the same angle from the preceding one. Write that turn as zzz. After rotating the whole picture together, three consecutive arrows have sum

S=1+z+z2.S=1+z+z^2.S=1+z+z2.

Multiply by zzz and subtract. The middle terms cancel. Only the first arrow and the new last arrow remain.

Three unit arrows labeled one, z, and z squared are joined head to tail. Their resultant is S. Multiplying S by z shifts the three terms one place, and subtraction cancels the middle terms, leaving (one minus z) times S equal to one minus z cubed. Three unit arrows labeled one, z, and z squared are joined head to tail. Their resultant is S. Multiplying S by z shifts the three terms one place, and subtraction cancels the middle terms, leaving (one minus z) times S equal to one minus z cubed.
Consecutive remainders give consecutive powers of the same turn. Multiply by that turn and subtract. The middle arrows cancel in the algebra, leaving the two endpoints and the geometric-sum ratio.

With nnn arrows, the same cancellation gives

S=1−zn1−z.S=\frac{1-z^n}{1-z}.S=1−z1−zn​.

On the unit circle, ∣1−z∣|1-z|∣1−z∣ is a chord length. An angle of 2πk/p2\pi k/p2πk/p gives a chord of length 2∣sin⁡(πk/p)∣2|\sin(\pi k/p)|2∣sin(πk/p)∣. The numerator uses nnn times that angle. Squaring the ratio gives the contribution of a bin of length nnn,

Kn(k)=sin⁡2(πkn/p)sin⁡2(πk/p),K_n(k)=\frac{\sin^2(\pi kn/p)}{\sin^2(\pi k/p)},Kn​(k)=sin2(πk/p)sin2(πkn/p)​,

for k=1,…,p−1k=1,\ldots,p-1k=1,…,p−1. At frequency zero, no division is needed. All nnn arrows line up, so Kn(0)=n2K_n(0)=n^2Kn​(0)=n2. An empty bin contributes zero.

Two lengths are enough

The first digit never decreases as the numerator increases. That makes every nonempty bin a consecutive block. Its length is also tightly constrained.

In base bbb, divide the p−1p-1p−1 nonzero remainders among the bbb possible digit bins. Write

p−1=bq+ρ,0≤ρ<b.p-1=bq+\rho,\qquad 0\le\rho<b.p−1=bq+ρ,0≤ρ<b.

Exactly ρ\rhoρ bins have length q+1q+1q+1. The other b−ρb-\rhob−ρ have length qqq. Here ppp is prime and does not divide the base. At thirteen in decimal, 12=10⋅1+212=10\cdot1+212=10⋅1+2. Eight singletons and two pairs.

We have already calculated the contribution of either length. Add them.

Φ(k)=(b−ρ)Kq(k)+ρKq+1(k).\Phi(k)=(b-\rho)K_q(k)+\rho K_{q+1}(k).Φ(k)=(b−ρ)Kq​(k)+ρKq+1​(k).

Monotonicity produces consecutive blocks. Consecutive blocks produce Dirichlet kernels. Squared magnitudes sum to Φ\PhiΦ. That is the whole construction.

The sliding calculation uses the same two lengths. A bin of length three has three matches at shift zero, two after one step, one after two, and none after three. Plot those counts in both directions and a triangle appears.

At twenty-nine in decimal, two bins have length two and eight have length three. They give 28 self-matches, 2⋅1+8⋅2=182\cdot1+8\cdot2=182⋅1+8⋅2=18 matches after one step, and eight after two. The reverse shifts give the same counts.

The sine formula and the two triangles

Substituting the interval contribution gives, for nonzero kkk,

Φ(k)=(b−ρ)sin⁡2(πkq/p)sin⁡2(πk/p)+ρsin⁡2(πk(q+1)/p)sin⁡2(πk/p).\begin{aligned} \Phi(k)={}&(b-\rho)\frac{\sin^2(\pi kq/p)}{\sin^2(\pi k/p)}\\ &+\rho\frac{\sin^2(\pi k(q+1)/p)}{\sin^2(\pi k/p)}. \end{aligned}Φ(k)=​(b−ρ)sin2(πk/p)sin2(πkq/p)​+ρsin2(πk/p)sin2(πk(q+1)/p)​.​

For a shift h∈{0,…,p−1}h\in\{0,\ldots,p-1\}h∈{0,…,p−1}, the circular distance is t=min⁡(h,p−h)t=\min(h,p-h)t=min(h,p−h). Write x+=max⁡(x,0)x_+=\max(x,0)x+​=max(x,0) for the positive part. The exact collision count is

Cadd(h)=(b−ρ)(q−t)++ρ(q+1−t)+.\begin{aligned} C_{\mathrm{add}}(h)={}&(b-\rho)(q-t)_+\\ &+\rho(q+1-t)_+. \end{aligned}Cadd​(h)=​(b−ρ)(q−t)+​+ρ(q+1−t)+​.​

No occurring bin is longer than half the residue circle. Its forward and backward overlap triangles therefore do not overlap away from their common center. These formulas retain empty bins when q=0q=0q=0 and include the prime-two endpoint.

The geometric sum, Parseval identity, and correlation transform are classical Fourier tools. The companion paper gives the proofs and references. The digit partition supplies the arithmetic restriction that reduces the calculation to two bin lengths.

The 156 does not move

Change the base while keeping the denominator thirteen. The bins change, so the zero-frequency power changes with them.

In base two there are two bins, {1,…,6}\{1,\ldots,6\}{1,…,6} and {7,…,12}\{7,\ldots,12\}{7,…,12}. Each contributes 626^262 at frequency zero, giving 72. Decimal has eight singletons and two pairs, giving 16. Base twelve puts each remainder in its own bin, giving twelve contributions of one.

Three additive power plots at denominator thirteen share one linear vertical scale. Base two has two six-member bins and zero mode 72. Decimal has eight singletons and two pairs, with zero mode 16. Base twelve has twelve singletons and constant power 12. Each spectrum sums to 156. Three additive power plots at denominator thirteen share one linear vertical scale. Base two has two six-member bins and zero mode 72. Decimal has eight singletons and two pairs, with zero mode 16. Base twelve has twelve singletons and constant power 12. Each spectrum sums to 156.
The bin populations explain all three zero modes. At base twelve, every frequency has power twelve. The other bases distribute the same total unevenly. The dashed line marks twelve, the common mean across frequencies.

Those are three different zero-frequency values. Add the power at all thirteen frequencies and each spectrum gives 156.

More generally, Parseval’s identity gives

∑k=0p−1Φ(k)=p(p−1).\sum_{k=0}^{p-1}\Phi(k)=p(p-1).k=0∑p−1​Φ(k)=p(p−1).

Changing the base can move power between frequencies. It cannot create or remove any. The fixed total comes from a count that never changes. With no shift, each of the p−1p-1p−1 nonzero remainders matches itself. The sum across frequencies is ppp times that self-match count.

The zero mode counts something else. A bin of size nnn contributes n2n^2n2 ordered pairs, including self-pairs. At thirteen in decimal, the sixteen pairs are twelve self-pairs and four distinct ordered pairs. Equivalently, add the shift counts 12+2+212+2+212+2+2.

This squared-bin count also enters The Alignment Limit for All Primes when the base has one remainder cycle. There it contributes to an average. Here it remains a raw count, separate from the fixed spectral total.

Sixty-nine spectra on one color scale

Each row below is one complete spectrum, for a base from two through twenty-four. The denominators are 29, 97, and 257. All powers are divided by their mean p−1p-1p−1, so every row has mean one. A shared logarithmic color scale keeps weaker features visible beside the large zero mode.

Three heatmaps of additive spectral power for primes 29, 97, and 257. Each has 23 rows for bases two through twenty-four, and one column per frequency. Power is divided by p minus one, its mean. A shared logarithmic color scale spans 0.0001 through 128 times the mean. Three heatmaps of additive spectral power for primes 29, 97, and 257. Each has 23 rows for bases two through twenty-four, and one column per frequency. Power is divided by p minus one, its mean. A shared logarithmic color scale spans 0.0001 through 128 times the mean.
Each colored cell is a computed power value, normalized by the row’s mean. All sixty-nine rows therefore have mean one before the logarithmic color mapping. The shared scale reveals redistribution across bases and denominators. Open the plate to inspect individual frequencies.

The logarithm is only a display choice. The calculation uses the original power values. Exact integer overlap counts, their Fourier transforms, and the two-length formula are checked against one another for every row.

A flat spectrum

Base twelve at thirteen shows what happens when every occupied bin is a singleton. Each bin contributes one at every frequency. There is no frequency at which it can reinforce or cancel with a neighbor in the same bin.

The converse holds too. A flat spectrum with total p(p−1)p(p-1)p(p−1) must have value p−1p-1p−1 everywhere, including at zero. But the zero-frequency count already contains the p−1p-1p−1 self-pairs. Any bin with two members adds distinct pairs and raises the count. So every occupied bin must be a singleton.

Digit separation, no matches at a nonzero shift, and flat spectral power describe the same boundary,

p≤b+1.p\le b+1.p≤b+1.

The bin sizes prove the boundary directly. When p−1≤bp-1\le bp−1≤b, the two permitted lengths are zero and one, or every bin has length one. When p−1>bp-1>bp−1>b, there are more remainders than bins. Some bin must contain a pair.

The same bins, a different walk

The power keeps the length of each arrow sum and discards its direction, or phase. Move a whole bin around the residue circle and its sum rotates. Its power stays the same. Power alone cannot tell us where that bin began.

Nor does it determine the multiplication walk. At seven, both base eight and base ten separate all six nonzero remainders. Both give additive power six at every frequency. Multiplying by eight modulo seven fixes every remainder. Multiplying by ten carries one through all six.

At denominator seven, multiplication by base eight fixes remainder one. Multiplication by base ten visits one, three, two, six, four, five, then one. Both additive power plots coincide at six for every frequency, shown by teal dots inside gold rings. At denominator seven, multiplication by base eight fixes remainder one. Multiplication by base ten visits one, three, two, six, four, five, then one. Both additive power plots coincide at six for every frequency, shown by teal dots inside gold rings.
Both bases put every remainder in a singleton bin, so the additive power is identical. The multiplication walks remain different. Additive power does not determine multiplicative order.

The earlier matrix articles follow those multiplication cycles. Here the full power profile recovers the counts for additive shifts. The distinction is already visible at seven, with a fixed point and a six-cycle sitting behind the same flat additive power.

The bins, triangles, and frequency plots together

These wider plates put the decimal examples side by side. Follow the bin lengths from seven to thirteen to twenty-nine, then compare their overlap triangles and power values. The arrow construction and fixed-total comparison are included at full size.

The decimal bins at seven, thirteen, and twenty-nine. Empty bins remain visible in the ten-bin count. The nonempty bins are consecutive and have at most two lengths.
The decimal bins at seven, thirteen, and twenty-nine. Empty bins remain visible in the ten-bin count. The nonempty bins are consecutive and have at most two lengths.
Neighboring remainders at frequencies one and six. The gold resultant shrinks as the unit arrows turn apart; its squared length is the bin's contribution to power.
Neighboring remainders at frequencies one and six. The gold resultant shrinks as the unit arrows turn apart; its squared length is the bin’s contribution to power.
The decimal overlap counts and power values at thirteen and twenty-nine. Blue and gold separate the contributions of the shorter and longer bins on both sides of the transform.
The decimal overlap counts and power values at thirteen and twenty-nine. Blue and gold separate the contributions of the shorter and longer bins on both sides of the transform.
Three bases at denominator thirteen. The zero modes are 72, 16, and 12, while the sum of all thirteen power values remains 156 in every base.
Three bases at denominator thirteen. The zero modes are 72, 16, and 12, while the sum of all thirteen power values remains 156 in every base.

Return to the first table. Four and five share one digit. Eight and nine share another. Advance the frequency and their arrows pull together, then apart. Every rise and fall in the power comes from those two pairs.

The other eight can turn all they like. Alone in their bins, they have nothing to cancel against.

Companion paper: The Spectral Power of the Digit Function →
Share

Discussion

Sign in to join the discussion.

← All articlesRead the paper →
← Previous: The Spectral Structure of Fractional Fields
Next: The Autocorrelation Formula →