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

The Autocorrelation Formula

January 26, 202211 min read
Companion paper: The Autocorrelation Formula →
Rows of luminous points form intersecting colored lines against a dark background.
A repeating word carries its pattern of agreements into frequency space. Each shift selects a different line.

Take the repeating block of 1/71/71/7 in base ten.

142857

Move the first digit to the end and put the two copies alongside each other.

1 4 2 8 5 7
4 2 8 5 7 1

No position agrees. Move two digits to the end, then three, four, five. Still nothing. Each digit occurs only once in the block, so no nontrivial rotation can bring a digit back onto itself.

Now try 1/171/171/17.

0 5 8 8 2 3 5 2 9 4 1 1 7 6 4 7
5 8 8 2 3 5 2 9 4 1 1 7 6 4 7 0

The third positions agree. So do the eleventh. The same one-place shift now gives two matches.

A one-place shift finds no matches in 142857 and two in the repeating block of one seventeenth.
A one-place shift finds no matches in 142857 and two in the repeating block of one seventeenth.

The number of matches at shift ℓ\ellℓ is the autocorrelation R(ℓ)R(\ell)R(ℓ). Here correlation means equal digits in equal positions. We are counting agreements, not multiplying the numerical digit values.

For seven, the complete list is 6,0,0,0,0,06,0,0,0,0,06,0,0,0,0,0. The first entry counts the unshifted word against itself. For seventeen, the list has sixteen entries and several are nonzero.

Writing out the words gives the answers. I want to see those answers in the remainder arithmetic that produces the words.

Following the remainders

Long division carries a remainder from one position to the next. In base ten, multiply it by ten, emit the whole-number digit, and keep the new remainder.

At denominator seventeen, a remainder of 222 gives

20=1⋅17+3.20=1\cdot17+3.20=1⋅17+3.

It emits 111 and leaves remainder 333. That remainder also emits 111, because 30=1⋅17+1330=1\cdot17+1330=1⋅17+13. These are the adjacent ones we just saw.

The adjacent eights have the same explanation. Remainder 151515 emits 888 and leaves remainder 141414. Remainder 141414 also emits 888.

A one-place shift compares each remainder with ten times that remainder, reduced modulo seventeen. A two-place shift compares it with a hundred times that remainder. Moving along a word has become multiplication in a finite table.

Make the table explicit. Label both its edges by the remainders. Fill a cell whenever its two remainders emit the same digit. Leave it empty otherwise.

The multiplication path meets the same-digit relation at two active cells, recovering the two matches without arranging the digits into a word.
The multiplication path meets the same-digit relation at two active cells, recovering the two matches without arranging the digits into a word.

The circles follow multiplication by ten. Two land on filled cells, at (2,3)(2,3)(2,3) and (15,14)(15,14)(15,14). The count is two again.

Call this equality table KKK. Its entries are just ones and zeros. Include a row and column labeled zero, but leave both empty. Zero is outside the repeating remainder orbit, and it contributes no match. The same construction works for any prime denominator ppp and any base bbb not divisible by ppp.

Keeping the positions

The Spectral Power of the Digit Function looked at the digit bins in frequency coordinates. Each bin contributed rotating arrows. Adding the arrows and squaring their total length gave its power at a frequency.

That calculation made the bin lengths visible. Squaring the length of an arrow, however, discards its direction. Move a bin along the remainder line and its Fourier arrows turn, even though their lengths stay the same.

Multiplication asks where a bin sits as well as how long it is. The equality table keeps that positional information. Take its Fourier transform in both directions, one for each remainder label. The resulting table is the cross-spectrum, G(k,k′)G(k,k')G(k,k′). It describes the same relation as KKK, in frequency coordinates. Fourier inversion can recover every original cell.

The familiar spectral power is still there. It occupies the cells G(k,−k)G(k,-k)G(k,−k), where the two frequency labels are opposites. The other cells preserve the relations between different frequencies.

There is a useful simplification. Replacing a remainder rrr by p−rp-rp−r replaces its digit by its complement. In decimal notation, the two digits add to nine. If two digits agreed before this reflection, their complements agree afterward. The filled cells of KKK therefore come in reflected pairs.

In the Fourier calculation, those pairs cancel the imaginary parts. Every entry of GGG is real. We can draw it as a table of ordinary signed numbers.

One line through the table

Return to the circles in the remainder grid. They follow a rule of the form s=ars=ars=ar, with multiplication reduced modulo the prime. Let C(a)C(a)C(a) count how many filled cells that path visits.

There is an exact way to read the same count from the frequency table.

C(a)=1p∑k=0p−1G(k,−a−1k).C(a)=\frac1p\sum_{k=0}^{p-1}G(k,-a^{-1}k).C(a)=p1​k=0∑p−1​G(k,−a−1k).

For each first label kkk, the formula selects one second label, −a−1k-a^{-1}k−a−1k. Add those ppp entries and divide by ppp. All labels are reduced modulo ppp. The inverse a−1a^{-1}a−1 is the number that undoes multiplication by aaa.

The reason a line survives is cancellation. Each Fourier term is a rotating arrow. Along the remainder path, its rotation is controlled by k+ak′k+ak'k+ak′. If that number is nonzero modulo ppp, the arrows complete a balanced circuit and sum to zero. If it is zero, they all point together. Only the frequency pairs satisfying k+ak′=0k+ak'=0k+ak′=0 survive, giving the line in the formula.

This works for every nonzero multiplier aaa. A cyclic shift chooses a particular one, a=bℓa=b^\ella=bℓ.

At seven and seventeen in base ten, the repeating word visits every nonzero remainder exactly once. The count over all remainders is therefore the count over all positions in that word,

R(ℓ)=C(bℓ).R(\ell)=C(b^\ell).R(ℓ)=C(bℓ).

This is where the full-period condition enters. The line formula itself does not need it.

Seven cells give zero

At seven, each occupied digit bin contains one remainder. Distinct remainders never emit the same digit. The table GGG then has only two values. It is 666 wherever k+k′=0k+k'=0k+k′=0 modulo seven, and −1-1−1 everywhere else.

The unshifted line collects seven sixes. The one-place shift collects one six and six minus ones, giving zero.
The unshifted line collects seven sixes. The one-place shift collects one six and six minus ones, giving zero.

At shift zero, the multiplier is one. The formula selects opposite frequency labels. All seven selected cells contain 666. Divide their total, 424242, by seven and recover the six matches of the unshifted word.

At shift one, the multiplier is 101010, which is 333 modulo seven. Its inverse is 555, because 3⋅53\cdot53⋅5 leaves remainder one. Negate that inverse and the line becomes k′=2kk'=2kk′=2k modulo seven.

Its seven cells are (0,0)(0,0)(0,0), (1,2)(1,2)(1,2), (2,4)(2,4)(2,4), (3,6)(3,6)(3,6), (4,1)(4,1)(4,1), (5,3)(5,3)(5,3), and (6,5)(6,5)(6,5). Only the first has labels whose sum is zero. It supplies 666. Each of the other six supplies −1-1−1.

R(1)=6+6(−1)7=0.R(1)=\frac{6+6(-1)}7=0.R(1)=76+6(−1)​=0.

Every other nontrivial shift meets the bright line only at the origin as well. All five nonzero shifts give zero.

The digit argument at the opening was shorter. The reason to build this table is that the same construction also handles seventeen, where bins contain several remainders and some shifted digits agree. The frequency entries change. The line formula does not.

Eight cycles at forty-one

At denominator forty-one, the decimal word for 1/411/411/41 is 024390243902439. It repeats after five places. Forty nonzero remainders are available, so this one word visits only an eighth of them.

The other remainders form seven more cycles. Their digit words need not have the same match counts.

At a two-place shift, the reference word has no matches. Six other cycles contribute one each, so the aggregate count is six.
At a two-place shift, the reference word has no matches. Six other cycles contribute one each, so the aggregate count is six.

Shift 024390243902439 by two places. None of its positions agrees. But the frequency line for multiplication by 10210^2102 gives six matches. It has added the contributions from all eight cycles. Six is the correct total, while zero is the correct answer for the reference word.

The distinction is exact. One line through GGG gives the aggregate over all cycles. To recover a chosen cycle, retain only its remainders in the Fourier calculation. The formula then uses a sum over that subgroup orbit instead of the simple cancellation over the whole field. It remains an exact formula, but generally involves the full frequency table rather than one line.

Back to the word

In the full-period case, the route to the matrix spectrum is now explicit. The digit bins give their Fourier coefficients. Those coefficients give GGG. A line through GGG gives each shifted match count. Divide those counts by the period length and take their discrete Fourier transform to obtain the eigenvalues of the cross-alignment matrix.

At the start, we moved a digit from one end of 142857142857142857 to the other and counted nothing. The frequency table gives that nothing a visible arithmetic form. One six is canceled by six minus ones. At seventeen, two matches remain. At forty-one, the answer depends on which cycles we have included. The same table construction accounts for all three, down to the individual match.

Companion paper: The Autocorrelation Formula →
Share

Discussion

Sign in to join the discussion.

← All articlesRead the paper →
← Previous: The Spectral Power of the Digit Function
Next: Phase-Filtered Ramanujan Sums and the Spectral Gate →