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

The Spectral Power of the Digit Function

October 26, 202114 min read
Companion paper: The Spectral Power of the Digit Function →
A changing gold contour answers a steady blue structure. A small arrangement of digit intervals determines a complete power profile, with the variable contribution tied to the paired bins.
A changing gold contour answers a steady blue structure. A small arrangement of digit intervals determines a complete power profile, with the variable contribution tied to the paired bins.

Write the fractions of thirteen in base two and in base ten and the digits have almost nothing in common. Base two sorts the twelve nonzero remainders into two bins of six, decimal spreads them over ten bins with two of them doubled up, and base twelve gives every remainder a bin of its own. Take the frequency spectrum of those bins and the three bases look completely different, a few tall spikes in binary, a gentle wave in decimal and a flat line in base twelve. Add up each spectrum, though, and all three come to exactly 156. Every prime has a fixed total like this that no choice of base can change, and every value along the way has an exact formula, because the digit bins are much simpler than the digits they produce.

Start with decimal. Divide each of the numbers from one through twelve by thirteen and read just the first decimal digit. Two fractions begin with a three, two begin with a six, and 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 and two contain a pair, 4 and 5 in the three-bin and 8 and 9 in the six-bin. Both pairs are neighbors, and those four numbers will account for the whole spectrum.

This time the move through the remainders is addition. The Spectral Structure of Fractional Fields followed multiplication by the base, and its spectrum was a list of eigenvalues. The bins are the same starting material here, but the move is different, so the power below is not 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, while five moves to six and leaves, so there is one match. Add two instead and both leave, and 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 three-bin, holding 4 and 5, with its remainders shifted by zero, one and two. Gold triangles land back inside the bin and gray ones land outside, so the matches fall from two to one to none.

The bin {8,9}\{8,9\}{8,9} behaves the same way, and each singleton loses its only match as soon as we shift it by any 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, and shifting backward matches the same pairs in reverse. Every other shift gives zero.

Shifts wrap around modulo thirteen, so passing twelve takes us to zero and then one. Remainder zero is left out of the table and contributes no match, which does not remove the digit-zero bin. That bin 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 from one remainder to the next, and 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, and 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 arrows for 4 and 5 at two frequencies, with their sum in gold. At frequency one they nearly agree and the sum has length 1.94, power 3.77. At frequency six they nearly oppose and the sum shrinks to 0.24, power 0.06.

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, since there is nothing for its arrow to cancel against, so 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, and 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 floor the singletons hold up.

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, and two forward 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 match count at each shift, twelve at zero and two on either side. Below, the power at the thirteen frequencies, a teal floor of eight from the singletons with the gold contribution of the two pairs rising and falling on top.

The Fourier transform takes the shift counts to these power values, and 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 have to go back 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 and 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, and the middle terms cancel, leaving only the first arrow and the new last one.

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.
Three consecutive remainders at frequency one, drawn as the arrows 1, z and z² laid end to end. Multiplying the sum by z and subtracting cancels the middle arrows, which is why only the two ends of a bin matter.

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, and 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, because all nnn arrows line up and 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, which makes every nonempty bin a consecutive block, and its length is tightly constrained too.

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 and the other b−ρb-\rhob−ρ have length qqq, with ppp prime and not dividing the base. At thirteen in decimal, 12=10⋅1+212=10\cdot1+212=10⋅1+2, which is eight singletons and two pairs.

We have already calculated the contribution of either length, so 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).

That is the whole construction. The digit never decreases, so every bin is a consecutive block, every consecutive block contributes one Dirichlet kernel, and the kernels come in only two lengths.

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, and plotting those counts in both directions draws a triangle.

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, so its forward and backward overlap triangles do not overlap away from their common center. These formulas keep 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 Spectral Power of the Digit Function 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, and 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 contributing 626^262 at frequency zero, for 72. Decimal has eight singletons and two pairs, for 16. Base twelve puts each remainder in its own bin, 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.
Thirteen in bases two, ten and twelve on one scale. Base two piles its power into a spike of 72 at frequency zero, decimal spreads it gently around the dashed mean of twelve, and base twelve is flat at twelve, yet all three add up to 156.

Those are three different zero-frequency values, but 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, but 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, and 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, self-pairs included, so at thirteen in decimal the sixteen pairs are twelve self-pairs and four distinct ordered pairs, the same as adding the shift counts 12+2+212+2+212+2+2. That is the squared-bin count from The Alignment Limit for All Primes, and here it is only the zero-frequency value, separate from the fixed total.

Sixty-nine spectra on one color scale

Each row below is one complete spectrum, for a base from two through twenty-four, at denominators 29, 97 and 257. All powers are divided by their mean p−1p-1p−1, so every row has mean one, and 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.
Sixty-nine spectra, one row per base from 2 to 24, at 29, 97 and 257. Power piles up in gold near frequency zero, at both ends of the rows and most strongly for the small bases, and fans out in arches as the base grows, while every row keeps the same total.

The logarithm is only a display choice, and 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, since there is no neighbor in the bin to reinforce or cancel against.

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. The zero-frequency count already contains the p−1p-1p−1 self-pairs, and any bin with two members adds distinct pairs and raises it, 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 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, and 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 while its power stays the same, so power alone cannot tell us where that bin began.

Nor does it determine the multiplication walk. At seven, base eight and base ten both separate all six nonzero remainders, and both give additive power six at every frequency. But multiplying by eight modulo seven fixes every remainder, while 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.
Denominator seven in base eight and base ten. Both put every remainder in its own bin, so both additive spectra are flat at six, yet multiplying by eight never leaves 1 while multiplying by ten walks through all six remainders.

The Cross-Alignment Matrix and The Spectral Structure of Fractional Fields follow those multiplication cycles. Here the full power profile recovers the counts for additive shifts, and seven already shows the difference, 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 the 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, and 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.

In the first table, four and five share one digit and eight and nine share another. Advance the frequency and each pair’s arrows pull together and then apart, and every rise and fall in the power comes from those two pairs. The other eight remainders 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 →