The best nested coloring of binary strings in blocks of up to four bits gives one same-color sum in seventeen
Why it matters
Give each binary string one of three colors and ask how rarely two strings and their bitwise sum all match. Reading four bits at a time brings the fraction down from one in sixteen to one in seventeen. No rule that reads at most four bits per block and continues only on an all-zero block can do better, though other ways of coloring strings might.
How much order must survive when we divide binary strings into three colors? One way to measure it is to pick two strings at random, add them bit by bit without carries, and ask how often both strings and their sum have the same color. A published rule that colors each string by just two bits gives one such match in sixteen. Reading the string in blocks gives more freedom: if a block is all zeros, the next block can decide the color instead. Both the block sizes and the color choices can then affect the fraction of matches.
For rules of this kind that read at most four bits per step, the smallest possible limiting fraction is 1/17. Repeating one four-bit pattern approaches that limit as the strings get longer. Changing the pattern or the block size along the way cannot lower it.
The coloring problem
At each bit, addition modulo two gives zero when the bits agree and one when they differ. A monochromatic Schur triple is a triple of the form (x,y,x+y) in which all entries have the same color. Its density is the fraction of ordered pairs (x,y) that give such a triple. We include repetitions, so strings of length n give 4^n pairs. Rué and Spiegel studied the limiting fraction for unrestricted three-colorings, counting only triples with distinct entries. The conventions give the same limit as n grows: entries coincide only when x=0, y=0 or x=y, events with combined probability at most 3/2^n.
For their two-bit rule, give the four strings 00,01,10,11 the colors red, blue, blue and green, respectively. Only (00,00) gives a monochromatic triple. Coloring longer strings by those same two bits keeps the density at 1/16. This gives an upper bound on the least possible density. Rué and Spiegel reported a lower bound of 0.041258 and gave a general method for repeating a coloring rule inside the set of strings whose selected bits are all zero (Proposition 3.5).
Here each step can use a different rule. On the space still to be colored, choose a map to d bits, with 1\le d\le4, that preserves addition and gives every possible output (a surjective linear map). Its N=2^d outputs label equal-sized sets of strings, called cells. Give each nonzero cell a color. Inside the cell labelled zero, called the kernel, apply the next rule. Give the last remaining point any color. In suitable coordinates each map simply reads the next block of bits.
A four-bit pattern with limiting density 1/17
To see which four-bit rule to repeat, write each block as the integer its bits represent. Leave zero for the next step and give each of the following sets its own color:
Each set has five elements and is sum-free: adding two of its elements never gives a member of the same set. This is the partition behind the Greenwood–Gleason coloring of the edges joining 16 points. Coloring the edge from u to v by the set containing u+v gives no single-color triangle, since the three edge labels of a triangle sum to zero.
Two features of the outer block determine how it combines with the coloring inside the kernel. Let a_i count the nonzero cells of color i. Let L count the unordered triples of distinct nonzero labels that have the same color and sum to zero. Inside the kernel, write p_i for the fraction of points of color i and t for the monochromatic density. For independent uniform strings x,y, the whole-space density D is
There are N^2 equally likely ordered pairs of cell labels. If all three labels are nonzero, each triple counted by L occurs in six orders. If just one label is zero, the other two agree. If the repeated label has color i, the entry in the kernel matches it with probability p_i, because that entry is uniform within the kernel. There are a_i choices for the repeated label and three choices for the position of the zero. Finally, if both sampled labels are zero, we have sampled an independent pair inside the kernel.
For the displayed partition, L=0 and all three a_i equal five. Whatever the color proportions inside the kernel, the middle term in the numerator is therefore 15. Wrapping one such step around a coloring of density t gives
Why changing the block cannot lower the limit
An unequal partition might give fewer matches: if many outer cells share a color that is rare in the kernel, a kernel entry will seldom match those cells. We find that every step other than a partition of the fifteen nonzero four-bit labels into three sum-free sets of equal size gives density at least 1/16, even if the kernel can use any coloring.
The kernel density t limits how common or rare any one color can be. If one color has proportion p, each entry has probability 1-p of missing that color. The chance all three have it is therefore at least 1-3(1-p), so t\ge 3p-2.
To bound the effect of a rare color, merge the color of proportion p into another color. The merge can create a monochromatic triple only if it touches the recolored set, an event of probability at most 3p. In the resulting two-coloring, say of proportions u,1-u, any two positions in the triple are independent and uniform. The expected number of pairs of positions with different colors is 6u(1-u). A two-color triple has either zero or two such pairs, so its monochromatic probability is 1-3u(1-u)\ge1/4. Subtracting the most the merge could have added gives t\ge 1/4-3p for the original coloring.
Order the three colors by their numbers of outer cells, from smallest (a) to largest (c), with a\le b\le c. Their kernel proportions sum to one, so the weighted sum in (1) becomes b-(b-a)p_a+(c-b)p_c, where the subscripts identify the corresponding colors. For a lower bound we can use the upper bound (t+2)/3 for p_a and the lower bound \max(0,(1/4-t)/3) for p_c. Substituting these bounds in (1) gives a lower bound that is linear on each side of t=1/4, so its minimum occurs at one of t=0,1/4,1. At those three endpoints the lower bounds for 4N^2D are 24L plus, respectively,
Table 1 gives the smallest bound at each endpoint across all assignments except the balanced sum-free four-bit partitions. In every row, all three minima are at least N^2/4. Since the bounds are on 4N^2D, this gives D\ge1/16 throughout. For example, at 16 cells even the most favorable remaining assignment gives a lower bound of at least 64/(4\cdot16^2)=1/16.
Table 1. Each assignment gives one of three named colors to each nonzero cell. The assignment totals include the balanced sum-free exceptions. The three columns headed by t give the smallest lower bounds on 4N^2D after excluding those exceptions.
| Cells N | Assignments | Exceptions | t=0 | t=1/4 | t=1 | Threshold N^2/4 |
|---|---|---|---|---|---|---|
| 2 | 3 | 0 | 1 | 1 | 4 | 1 |
| 4 | 27 | 0 | 5 | 4 | 4 | 4 |
| 8 | 2,187 | 0 | 18 | 16 | 16 | 16 |
| 16 | 14,348,907 | 2,016 | 68 | 64 | 64 | 64 |
For each row we counted, in every subset of the nonzero labels, the triples x>y>z with x+y=z in binary addition. We took every subset as the first color, every subset of its complement as the second, and the remaining labels as the third. Adding the three precomputed triple counts gives L for each of the 3^{N-1} assignments, including those with an unused color. The 2,016 exceptions all describe the displayed partition in different coordinates or colors: we tried each change of binary coordinates by mapping the four coordinate vectors to every possible ordered basis. This gave 336 distinct partitions when color names were ignored, and each admits six assignments of those names.
Rules that approach the limit
Approaching 1/17 requires an increasingly long initial run of the four-bit partition. If the first different step follows k balanced sum-free steps, its density is at least 1/16. Each of the k outer steps divides the excess above 1/17 by 256, so the density of the whole coloring is at least
Minimum count for a fixed string length
For strings of each length (dimension) n the smallest count within the class is exactly \lceil4^n/17\rceil. The brackets mean rounding up: the count must be a whole number and the density bound requires at least 4^n/17 pairs. To attain it, start with dimensions 0,1,2,3, where the four ceilings are 1,1,1,4. Color the single point, give the two points different colors, use the two-bit coloring, or use that same coloring while ignoring a third bit, respectively. Adding a balanced sum-free step outside a coloring with m monochromatic pairs gives 15\cdot4^n+m pairs in dimension n+4, by (1). Since 4^{n+4}/17=15\cdot4^n+4^n/17, the new ceiling exceeds the old one by exactly 15\cdot4^n pairs. The construction therefore attains the minimum at every length.
As a check independent of the recurrence, we assigned a color to every string by the block rule and compared the colors of x,y,x+y for every ordered pair through dimension 12. All counts matched the ceiling, including 986,896 out of 16,777,216 pairs in dimension 12.
For unrestricted colorings, the construction improves the limiting upper bound from 1/16 to 1/17. Any further improvement must use a rule outside this nested class.