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

Bin Derangements and the Gate Width Theorem

July 4, 202216 min read
Companion paper: Bin Derangements and the Gate Width Theorem →
Three families of paths exchange places around an untouched center. The circulation suggests a bin derangement: every remainder moves out of its original digit compartment.
Three families of paths exchange places around an untouched center. The circulation suggests a bin derangement: every remainder moves out of its original digit compartment.

Multiply every nonzero remainder modulo thirteen by the same number and ask whether any of them keeps its first decimal digit. For nine of the eleven multipliers other than one, none does. At twenty-nine the count is nine again, at eighty-three it is nine, and at a thousand and nine, with over a thousand multipliers to choose from, it is still exactly nine.

Counts like this usually grow with the problem. The oldest version is the matching problem Montmort solved in 1708, usually told today as a cloakroom handing back hats at random, where the number of ways for nobody to get their own hat grows so quickly that its share of all the ways settles near 1/e1/e1/e. Here the prime can grow without limit and the count does not move. In base bbb there are always exactly b−1b-1b−1 of these multipliers, and they can be written down as fixed fractions before the prime is even chosen. Phase-Filtered Ramanujan Sums and the Spectral Gate found these zeros as a cancellation in a spectrum. Here they come straight from the digit bins.

Thirteen’s bins are small enough to hold in your head. Two of its fractions begin with three,

4/13 = 0.307692...
5/13 = 0.384615...

two more, 8/138/138/13 and 9/139/139/13, begin with six, and every other first digit belongs to just one fraction. Grouping the numerators by first digit gives ten bins, eight holding one number and two holding two.

Multiply every numerator by six and take the remainder after division by thirteen. Five becomes four, since 6⋅5=306\cdot5=306⋅5=30 leaves remainder four, and both fractions begin with three. Eight becomes nine, and both begin with six. No other numerator keeps its first digit, so if C(g)C(g)C(g) counts the collisions for multiplier ggg, we have C(6)=2C(6)=2C(6)=2.

Now try every multiplier from two through twelve. One is left out, since it leaves all twelve rows alone.

Multiplier Collisions
2 0
3 0
4 0
5 0
6 2
7 0
8 0
9 0
10 0
11 2
12 0

Each of the nine multipliers with a zero moves every numerator out of its original digit bin, and I call such a multiplier bin deranging, after the hats.

Two exact remainder-permutation diagrams at prime thirteen. Multiplication by two moves all twelve remainders out of their first-digit bins. Multiplication by six keeps five to four inside bin three and eight to nine inside bin six. A row below records the eleven counts, with nine exact zeros. Two exact remainder-permutation diagrams at prime thirteen. Multiplication by two moves all twelve remainders out of their first-digit bins. Multiplication by six keeps five to four inside bin three and eight to nine inside bin six. A row below records the eleven counts, with nine exact zeros.
The twelve remainders at thirteen moved by two and by six, with the shaded columns as digit bins. Every path under two leaves its bin, while under six the moves 5 to 4 and 8 to 9 stay inside, and the row of gold zeros below marks all nine deranging multipliers.

At thirteen only two nonidentity multipliers lie outside the zero set, and at a thousand and nine there are 998, yet the number with no collisions is nine both times. In base seven the count is six for every prime greater than seven, and in base three it is two. For every integer base b≥2b\ge2b≥2 and every prime p>bp>bp>b there are exactly b−1b-1b−1 bin-deranging multipliers, and that is the gate width theorem.

A list before the prime

In base ten the entire zero set comes from nine fixed fractions, running from −1/9-1/9−1/9 to −9-9−9 with −1-1−1 in the middle.

These are fractions in modular arithmetic. The fraction −1/9-1/9−1/9 modulo thirteen means the number that gives −1-1−1 when multiplied by nine, which is ten, since 9⋅10=909\cdot10=909⋅10=90 is one less than a multiple of thirteen. At twenty-nine the same fraction gives sixteen, since 9⋅16=1449\cdot16=1449⋅16=144 is one less than a multiple of twenty-nine. The fraction stays fixed while its residue changes with the prime.

Nine fixed rational fractions are linked to their residues at primes thirteen, twenty-nine, eighty-three and 1009. Every prime column is sorted numerically, so the threads cross as the prime changes. Matching colors identify reciprocal fractions. The gold thread, negative one, always ends at p minus one. Nine fixed rational fractions are linked to their residues at primes thirteen, twenty-nine, eighty-three and 1009. Every prime column is sorted numerically, so the threads cross as the prime changes. Matching colors identify reciprocal fractions. The gold thread, negative one, always ends at p minus one.
The nine fixed fractions threaded through 13, 29, 83 and 1009, each column sorted by residue. The order reshuffles from prime to prime but every column holds exactly nine, the gold thread −1 always lands on p − 1, and the arcs below pair the fractions whose product is one.

For a general base, run uuu from one through b−1b-1b−1. The list is

gu≡−ub−u(modp).g_u\equiv-\frac{u}{b-u}\pmod p.gu​≡−b−uu​(modp).

Every denominator is smaller than ppp, so every division is defined, the resulting multipliers are distinct, and these are all the zeros.

Read the list from opposite ends and the first and last fractions multiply to one, as do the second and second-last. In the formula, uuu and b−ub-ub−u give inverse multipliers, so undoing a bin derangement is another bin derangement.

For an even base the middle fraction is −1-1−1, which sends digit ddd to b−1−db-1-db−1−d, and no digit is its own complement in an even base. Decimal pairs zero with nine, one with eight, and so on. In an odd base the middle digit is its own complement, so this argument does not give a derangement.

From first digits to last digits

The bins are intervals of numerators, and multiplication modulo a prime scatters them, but a change of labels makes them easier to follow. Replace each numerator rrr by the remainder of 10r10r10r divided by thirteen. The pair four and five becomes one and eleven, and the pair eight and nine becomes two and twelve.

All twelve remainders at thirteen are carried from first-digit bins to last-digit classes by multiplication by ten modulo thirteen. Teal paths carry four and five to one and eleven. Violet paths carry eight and nine to two and twelve. The remaining eight paths are shown in gray. All twelve remainders at thirteen are carried from first-digit bins to last-digit classes by multiplication by ten modulo thirteen. Teal paths carry four and five to one and eleven. Violet paths carry eight and nine to two and twelve. The remaining eight paths are shown in gray.
Each remainder at thirteen multiplied by ten and reduced. Four and five travel together to the last-digit-1 column as 1 and 11, and eight and nine to the last-digit-2 column as 2 and 12, so the numbers change but who belongs with whom does not.

A shared first digit has become a shared last digit. The digit itself need not stay the same, but which numbers belong together does.

To see why, use base bbb and write x=[br]px=[br]_px=[br]p​. The brackets mean take the remainder between one and p−1p-1p−1. If ddd is the first digit of r/pr/pr/p, long division says

br=pd+x.br=pd+x.br=pd+x. x≡−pd(modb).x\equiv-pd\pmod b.x≡−pd(modb).

The prime p>bp>bp>b is coprime to the base, so multiplication by −p-p−p permutes the digit classes modulo bbb, and two first digits agree exactly when their transformed remainders have the same last digit.

Multiplication by ggg also survives the relabeling, since the transformed image of [gr]p[gr]_p[gr]p​ is [gx]p[gx]_p[gx]p​. A collision is now exactly

x≡[gx]p(modb).x\equiv[gx]_p\pmod b.x≡[gx]p​(modb).

Multiply, reduce modulo the prime, then compare modulo the base. What we are looking for now is numbers separated by whole multiples of bbb.

The two sides of ten

Give each nonidentity multiplier a label ccc between one and p−1p-1p−1 by solving

c(1−g)≡b(modp).c(1-g)\equiv b\pmod p.c(1−g)≡b(modp).

The label bbb is excluded because it would give g=0g=0g=0, and every other label occurs exactly once. The reverse rule is g≡1−b/c(modp)g\equiv1-b/c\pmod pg≡1−b/c(modp).

Labels below the base give no collisions and labels above the base always give one, and both statements can be proved without examining a table.

Suppose a collision exists and put y=[gx]py=[gx]_py=[gx]p​. Since xxx and yyy agree modulo bbb, we can write y=x+mby=x+mby=x+mb for an integer mmm, and they are distinct because g≠1g\ne1g=1. Multiplying the relation mb≡(g−1)xmb\equiv(g-1)xmb≡(g−1)x by ccc gives

mbc≡−bx(modp).mbc\equiv-bx\pmod p.mbc≡−bx(modp). x+mc≡0(modp).x+mc\equiv0\pmod p.x+mc≡0(modp).

Now suppose 0<c<b0<c<b0<c<b. Stepping by ccc takes us only part of the way that stepping by bbb does, so the number x+mcx+mcx+mc lies strictly between xxx and yyy, whether mmm is positive or negative.

Two schematic open intervals from zero to p. Nine gold points lie between x and y and are labeled by c from one through nine. For negative m their order reverses, but they remain inside the interval, which has no multiple of p. The numbers label c, not the coordinate z. Two schematic open intervals from zero to p. Nine gold points lie between x and y and are labeled by c from one through nine. For negative m their order reverses, but they remain inside the interval, which has no multiple of p. The numbers label c, not the coordinate z.
The labels c = 1 through 9 placed at z = x + mc, between the two ends of a supposed collision, in either direction. Every one lands strictly inside the interval from 0 to p, where no multiple of p can sit, so no such collision exists.

Both endpoints lie in the open interval (0,p)(0,p)(0,p), which contains no multiple of ppp, so the required divisibility is impossible. That settles every label below the base.

Above the base, write down a match. For c>bc>bc>b, take

x=p−c,y=x+b.x=p-c,\qquad y=x+b.x=p−c,y=x+b.

Both lie between one and p−1p-1p−1 and agree modulo bbb, and the defining equation gives (1−g)x≡−b(modp)(1-g)x\equiv-b\pmod p(1−g)x≡−b(modp), so [gx]p=x+b=y[gx]_p=x+b=y[gx]p​=x+b=y.

At thirteen, multiplier six has label eleven, and the construction gives x=2x=2x=2 and y=12y=12y=12. Undo the substitution and they become eight and nine, the collision from the beginning.

A number line from zero to thirteen places x at two, eleven places below thirteen, and y at twelve, ten places above x. A commuting square shows multiplication by six taking two to twelve, and after undoing the relabeling, eight to nine. The first pair shares last digit two; the second shares first digit six. A number line from zero to thirteen places x at two, eleven places below thirteen, and y at twelve, ten places above x. A commuting square shows multiplication by six taking two to twelve, and after undoing the relabeling, eight to nine. The first pair shares last digit two; the second shares first digit six.
The match the proof builds at thirteen for multiplier six, whose label is 11. Starting at 13 − 11 = 2 and adding ten gives 12, both ending in 2, and undoing the relabeling turns 2 → 12 into 8 → 9, two fractions that begin with six.

Every nonidentity multiplier is on one side or the other, and the zero labels are exactly 1,2,…,b−11,2,\ldots,b-11,2,…,b−1. Substitute c=b−uc=b-uc=b−u into g=1−b/cg=1-b/cg=1−b/c and we recover −u/(b−u)-u/(b-u)−u/(b−u), so the count and the list come from the same argument.

The scattered zeros line up

The left-hand tables order multipliers numerically and the right-hand tables order them by ccc. The columns stay fixed, and no comparison is added or removed.

Complete collision grids at thirteen, eighty-three and 1009, ordered by multiplier on the left and by c on the right. Gold marks nine empty rows, collected at the bottom on the right. A true eighty-four-column crop at 1009 enlarges the boundary between the nine empty rows and the first constructive labels. Complete collision grids at thirteen, eighty-three and 1009, ordered by multiplier on the left and by c on the right. Gold marks nine empty rows, collected at the bottom on the right. A true eighty-four-column crop at 1009 enlarges the boundary between the nine empty rows and the first constructive labels.
Every comparison at 13, 83 and 1009, rows sorted by multiplier on the left and by label c on the right. Sorted by label, the nine empty rows collect into one band at the bottom, and the close-up at 1009 shows that band cell by cell.

Columns are transformed remainders xxx, and a colored cell means that xxx and [gx]p[gx]_p[gx]p​ share a last decimal digit, with the color naming that digit rather than the original leading digit. The identity multiplier is left out of both orders.

Gold marks the nine empty rows, which on the right become the bottom band at labels one through nine. Label ten is left out because it would give multiplier zero, and every row above the band contains a match.

The largest table has 1007⋅1008=1,015,0561007\cdot1008=1{,}015{,}0561007⋅1008=1,015,056 cells, shown in both orders and all kept in the full-size plate. The colors show the arrangement beyond the gate changing from prime to prime while the empty band stays the same width.

Multipliers that shift one repetend

The proof uses every nonzero remainder. It does not require the base to visit them all in one cycle.

If bbb is a primitive root modulo ppp, its powers visit all p−1p-1p−1 remainders. Multiplication by bℓb^\ellbℓ then compares a complete repetend with its shift by ℓ\ellℓ. Nonzero shifts and nonidentity multipliers correspond one to one, so exactly b−1b-1b−1 nonzero shifts have no digit matches.

On a shorter cycle, a shift can miss every digit there while producing collisions elsewhere. The full multiplier classification does not give the exact zero count on that shorter word.

Bin Derangements and the Gate Width Theorem gives the formal statements and their relation to earlier work on sequence correlation.

Four matches, two ways

Thirteen’s two crowded bins allow four moves in all. Inside the digit-three bin we can go from four to five or from five to four, and inside the digit-six bin from eight to nine or from nine to eight. Each of those four ordered pairs belongs to exactly one multiplier, the destination divided by the starting residue modulo thirteen.

Directed arrows connect four and five inside digit bin three and eight and nine inside digit bin six. Multiplication by six supplies five to four and eight to nine; multiplication by eleven supplies the two reverse arrows. The same four arrows are then regrouped by multiplier, two in each group. Directed arrows connect four and five inside digit bin three and eight and nine inside digit bin six. Multiplication by six supplies five to four and eight to nine; multiplication by eleven supplies the two reverse arrows. The same four arrows are then regrouped by multiplier, two in each group.
The four moves inside thirteen’s two crowded bins, counted first by bin and then by multiplier. Six takes 5 to 4 and 8 to 9 and eleven takes the reverse moves, so four ordered pairs shared by two multipliers give a mean of two.

A bin containing ndn_dnd​ residues has nd(nd−1)n_d(n_d-1)nd​(nd​−1) ordered pairs with distinct entries, and adding over bins counts every collision outside the identity. The zero multipliers contribute nothing and the remaining p−b−1p-b-1p−b−1 multipliers share the total, so their mean is

C‾=∑dnd(nd−1)p−b−1.\overline C=\frac{\sum_d n_d(n_d-1)}{p-b-1}.C=p−b−1∑d​nd​(nd​−1)​.

At thirteen, four matches divided between two multipliers gives a mean of two. At the boundary prime eleven every bin is a singleton, all nonidentity multipliers are deranging, and there is nothing left to average, so the mean requires p>b+1p>b+1p>b+1.

At twenty-nine, eight bins hold three residues and two hold two, supplying 8⋅6+2⋅2=528\cdot6+2\cdot2=528⋅6+2⋅2=52 matches. Eighteen nonidentity multipliers lie outside the zero set, giving a mean of 52/18=26/952/18=26/952/18=26/9.

The mean from the bin sizes

Write p−1=bQ+Rp-1=bQ+Rp−1=bQ+R, with 0≤R<b0\le R<b0≤R<b, so there are RRR bins of size Q+1Q+1Q+1 and b−Rb-Rb−R of size QQQ. Their ordered pairs total

∑dnd(nd−1)=R(Q+1)Q+(b−R)Q(Q−1)=Q(b(Q−1)+2R).\begin{aligned} \sum_d n_d(n_d-1) &=R(Q+1)Q\\ &\quad +(b-R)Q(Q-1)\\ &=Q\bigl(b(Q-1)+2R\bigr). \end{aligned}d∑​nd​(nd​−1)​=R(Q+1)Q+(b−R)Q(Q−1)=Q(b(Q−1)+2R).​

There are p−b−1=b(Q−1)+Rp-b-1=b(Q-1)+Rp−b−1=b(Q−1)+R multipliers to share those pairs. Thus

C‾=Q(b(Q−1)+2R)b(Q−1)+R.\overline C=\frac{Q\bigl(b(Q-1)+2R\bigr)}{b(Q-1)+R}.C=b(Q−1)+RQ(b(Q−1)+2R)​.

The mean equals two throughout b+1<p≤2b+1b+1<p\le2b+1b+1<p≤2b+1. In this range the bins have one or two members, apart from the endpoint where all have two, so the only nonzero within-bin contributions are two per double bin, and their total is twice the number of nonidentity multipliers outside the gate.

When R=0R=0R=0 and the mean is defined, all bins have the same size QQQ and the formula reduces to C‾=Q\overline C=QC=Q.

The sum does not say how each individual multiplier behaves, only exactly how many matches they have to share.

The fraction list, the relabeling, and the pairs

These wider plates place the four prime fields side by side, join the change of coordinates to its parameter line, and collect the ordered pairs inside the two crowded bins.

The nine fixed fractions across the columns, with their residues at four primes underneath. Each prime's row is its complete decimal zero set.
The nine fixed fractions across the columns, with their residues at four primes underneath, so that each prime’s row is its complete decimal zero set.
The two crowded bins at thirteen become last-digit classes. The parameter line places all nine zero multipliers below ten and the two positive-count multipliers above it.
The two crowded bins at thirteen become last-digit classes. The parameter line places all nine zero multipliers below ten and the two positive-count multipliers above it.
The four ordered pairs with distinct entries in the crowded bins at thirteen. They divide evenly between multipliers six and eleven.
The four ordered pairs with distinct entries in the crowded bins at thirteen. They divide evenly between multipliers six and eleven.

At thirteen the two crowded bins leave only four matches to share out. Once the prime passes twice the base every bin is crowded and more multipliers keep a digit somewhere in the table, but nine still keep none, and they are the same nine fractions, −1/9-1/9−1/9 through −9-9−9, reduced modulo whatever prime we choose.

Companion paper: Bin Derangements and the Gate Width Theorem →
Share

Discussion

Sign in to join the discussion.

← All articlesRead the paper →
← Previous: Phase-Filtered Ramanujan Sums and the Spectral Gate
Next: The Character Structure of the Collision Fluctuation →