FindingMath

A near-minimum count of single-color triples reveals a repeating 27-point pattern

Version 1 Published 2026-11-21 DOI 10.5281/zenodo.24435150

Importance (self-rated) Notable

It answers the stability question posed by Rué and Spiegel with a sharp dimension-independent edit law, not just a classification of exact examples.

Why it matters

Suppose you color strings of digits 0, 1 and 2 to make it rare for three equally spaced strings to share a color. A count close to the lowest possible tells you that the coloring nearly repeats one pattern of 27 cells. It also tells you how much repair the pattern needs: one extra matching triple per million triples means about three points per million need a new color.

Suppose we want to recover a pattern of colors from just one measurement: how often three equally spaced points have the same color. On a grid where each coordinate cycles through 0, 1 and 2, a repeating 27-point pattern makes that fraction as small as possible with three colors. Knowing the minimum leaves a question about recovery: could a very different pattern give almost the same count?

We show that every coloring close to the minimum agrees with the 27-point pattern except on a small fraction of the grid. If the share of single-color triples exceeds the minimum of 1/27 by \epsilon, the smallest fraction of points that must change color to recover the pattern is about 3\epsilon. The error is of order \epsilon^2, with the same bound however many coordinates the grid has, starting at three.

The triples and the pattern

A point in the grid V=\mathbb F_3^n is a string of n digits from \{0,1,2\}. We add and subtract points coordinate by coordinate modulo three. To sample an equally spaced triple, or progression, choose a base point x and a step d independently and uniformly from the grid. The triple is x-d,x,x+d. For a nonzero step these are the three points of a line. For the zero step all three positions contain the same point. Given a coloring f, let T(f) be the probability that all three positions have the same color (are monochromatic). This count includes the zero step. With N=3^n points, the fraction among distinct-point progressions is (NT(f)-1)/(N-1).

Rué and Spiegel proved that the asymptotic minimum fraction of monochromatic progressions is 1/27 and asked what colorings near this minimum look like. Their example begins with Figure 1. Each color occupies a set of nine points containing no whole line, called a cap. On a larger grid, assign each point the color shown for its first three coordinates. A progression then has one color exactly when the step is zero in those three coordinates. That happens with probability 1/27.

Three slices of the 27-point coloring, with colors labeled 0, 1 and 2.

Figure 1. The 27-point pattern. The color at (i,j,k) is c(i,j,k)=i+2j(j-1)+2k(k-1)\pmod 3. Each successive slice cycles the color labels. Using only three coordinates to assign colors on a larger grid repeats the pattern on equally sized sets of points.

We call any copy of this repeated pattern a template. We allow a change of coordinates (an invertible linear transformation followed by a shift) and any relabeling of the colors. Equivalently, after choosing the labels, any affine map from V onto the 27 points gives a template: color each point according to its image. Follett and colleagues showed that every partition of the 27 points into three caps of maximum size is equivalent under affine changes of coordinates. In a larger grid, the question is why just three coordinates should suffice.

For every n\ge3, the minimum of T is 1/27, and precisely the templates attain it. Write r for the smallest fraction of points on which f differs from any template and \epsilon=T(f)-1/27 for the excess above the minimum. Our bound is

|r-3\epsilon|\le144\epsilon^2\qquad(0\le\epsilon\le10^{-6}).
The cutoff gives a sufficient range for the bound. The factor three is sharp, and examples in growing dimension require an error of quadratic order.

What parallel lines tell us

In a template, a step that leaves the three chosen coordinates unchanged preserves every point's color. Every progression with that step is monochromatic. For any other step, none is. We can look for this distinction even before we know which coordinates to use. For each step d, let s(d) be the fraction of base points that give a monochromatic progression. Its average over all steps is T(f). Choose two base points independently for the same step. The probability that the first progression is monochromatic and the second is not satisfies

v:=\mathbb E_d\,s(d)(1-s(d))\le14\epsilon. \tag{1}
Thus when the overall count is near its minimum, most steps have a monochromatic fraction close to zero or one.

To prove (1), we counted every coloring of a nine-point plane. It has four directions, each with three parallel lines. Let m be the fraction of lines that are monochromatic. Let b be the fraction of ordered pairs of distinct parallel lines for which the first is monochromatic and the second is not. Rué and Spiegel's proof supplies a matrix of weights, their lower-bound certificate. It assigns each plane coloring a correction q based on pairs of lines through a common point (Methods). The amount left over, m-1/27-q, is called the slack. Among all 3^9 colorings, every coloring with zero slack had b=0. For every other coloring, b was at most 14 times the slack.

Table 1. Parallel-line disagreement across all labeled plane colorings. A mixed pair counts only in the order monochromatic line first. The last column takes the maximum over colorings of strictly positive slack.

Mixed ordered pairs (of 24) Plane colorings Zero slack Largest mixed fraction / slack
0 3,861 405 0
2 11,016 0 14
4 2,592 0 1701/292
6 1,728 0 6804/1625
8 486 0 162/23

To apply Table 1 in any dimension, take a random affine map from the plane into V. The map sends a plane point z to a+Lz, where the shift a and the two columns of the matrix L are independent uniform points of V. Color each plane point by the color of its image. We include maps that collapse a line or even the whole plane to a point. Under this sampling rule a fixed line has a uniform base point and an independent uniform step, so \mathbb E m=T(f).

For two distinct parallel lines, the image steps are the same. Given that step, the base points are independent and uniform because the displacement across the lines supplies an independent uniform vector. Hence \mathbb E b=v. For two lines through a common point, the steps are independent given the image of their shared point. With the certificate weights this gives \mathbb E q\ge0 (Methods). Averaging the plane inequality b\le14(m-1/27-q) now gives (1) and, since v\ge0, the minimum bound T(f)\ge1/27.

Recovering the 27 cells

We first identify the steps that almost preserve color. Let t(d)=\Pr_x[f(x)\ne f(x+d)] be the fraction of points whose color changes under a shift by d. Around a line that is not monochromatic, either two or three of the three directed edges change color. This gives

\tfrac23(1-s(d))\le t(d)\le1-s(d).
Let A contain the steps with t(d)<1/8 and D the steps with t(d)<1/4. The zero step belongs to A, and reversing a step leaves the disagreement unchanged: t(-d)=t(d). The disagreement after two shifts is at most the sum of their individual disagreements. Thus every sum of two members of A lies in D.

The two sets occupy nearly the same fraction of the grid. Write \mu for the fraction of all points in a set. Then

\mu(A)\ge T(f)-8v,\qquad \mu(D)\le T(f)+8v/5.
To see the first bound, observe that outside A we have 1-s\ge1/8, so s\le8s(1-s). For the second, inside D we have s>5/8, so 1-s\le(8/5)s(1-s). Averaging gives the stated bounds. For \epsilon\le10^{-6}, (1) makes the upper bound for \mu(D) less than 3/2 times the lower bound for \mu(A).

This leaves so little room for new steps that the set of sums H=A+A is already a subspace. Here is the counting argument. Because A=-A, each h\in H can be written as a-b with a,b\in A. The shifted sets a+A and b+A both lie in H. Since |H|<3|A|/2, their overlap contains more than |A|/2 points. Equivalently, more than half the points x\in A have x-h\in A. For any h,k\in H, some x must therefore work for both. This puts h-k=(x-k)-(x-h) in H. Closure under subtraction makes H a subspace.

Since A\subseteq H\subseteq D, the fraction of the grid in H lies between 1/27-111\epsilon and 1/27+(117/5)\epsilon. Each independent coordinate restriction on a subspace cuts its size by a factor of three. The only reciprocal power of three between these bounds is 1/27.

The grid therefore splits into 27 cells, the translates (or cosets) of H. Give all points in each cell its most frequent color and call the resulting coloring g. If the proportions of the colors in a cell are p_i, the fraction edited is 1-\max_i p_i. This is at most 1-\sum_i p_i^2, the probability that two independent points from the cell disagree. To sample such a pair in a random cell, take a uniform point of the grid and shift it by a uniform member of H. Since H\subseteq D, averaging the disagreement bounds the overall fraction edited, \rho, by

\rho\le\mathbb E_{d\in H} t(d) \le 27\,\mathbb E_d[\mathbf 1_H(d)(1-s(d))]\le27(8/5)v\le605\epsilon .
Here \mathbf 1_H(d) is one for steps in H and zero otherwise.

Only progressions that meet an edited point can change their contribution to the count, so T(g)\le1/27+\epsilon+3\rho<1/27+6/729. The cells themselves form a 27-point grid. Its zero step accounts for 1/27, and even one monochromatic line would add 6/729 from its three base points and two nonzero steps. Thus each color occupies a cap. A cap on this grid has at most nine points, so each of the three colors must occupy exactly nine. The classification by Follett and colleagues (Table 1 and Proposition 2.2 of their paper) now identifies g as a template. This gives r\le605\epsilon and identifies every coloring with zero excess. To sharpen the distance bound, we count how edits affect the triples.

How much one edit costs

Fix a nearest template. In a sampled progression, consider the effect of changing the color at one position while keeping the other two positions at their template colors. If the changed point lies in cell u, the other two cells are u+d,u-d for a uniform step d on the 27-cell grid. Just one of the 27 steps makes both neighbors match the old color; four make them both match a specified new color.

To see these counts, expand the color formula in Figure 1 with step coordinates (d_1,d_2,d_3). The two neighbor colors are

c(u)+2(d_2^2+d_3^2)\ \pm\ \ell_u(d),
where \ell_u is linear in d with coefficient one on d_1. For each (d_2,d_3), making the neighbors equal fixes d_1. Their common offset from c(u) is zero only for (0,0) and takes each nonzero value four times. This also verifies that Figure 1 has no monochromatic line.

Each of the three positions lands on an edit with probability r. Adding their effects separately predicts an excess of 3r(4-1)/27=r/3. The only discrepancy comes from progressions in which edits affect more than one position. If k positions change, the actual change in the match count differs from the sum of the separate changes by at most \binom{k}{2}. For k\le1 the two counts agree. On an initially monochromatic triple, each separate edit breaks the match; two simultaneous edits still break it, and three can restore at most one match. On any other triple at most one separate edit can produce a match, so the discrepancy is at most one when k\ge2.

Any two positions in a random progression are independent uniform points: choosing their values fixes the third because the three sum to zero. Both points of a given pair therefore land on edits with probability r^2, wherever the edits lie. Summing over pairs gives

|\epsilon-r/3|\le3r^2. \tag{2}
Since r\le605\epsilon and \epsilon\le10^{-6}, (2) gives \epsilon\ge r(1/3-3r)\ge r/4. Substituting r\le4\epsilon back into (2) yields |r-3\epsilon|\le144\epsilon^2.

Changing a single point shows why the quadratic error is necessary. Only the constant progression at that point meets the edit more than once. It stays monochromatic, whereas adding the effects separately predicts the loss of three matches. Its probability is 1/N^2, so the exact excess is 1/(3N)+3/N^2. The distance to the nearest template is 1/N: the count is above the minimum, and one edit restores it. This attains the upper bound on the excess in (2).

For n\ge12, this single edit also gives the second-smallest value of T. Any coloring with positive excess at most the one-edit value is within the theorem's range. Its distance in points satisfies 0<Nr\le4N\epsilon\le4/3+12/N<2. Since the number of edits must be an integer, precisely the colorings one edit from a template attain the next value.

Methods

For the plane count we used the rational certificate and example published by Rué and Spiegel. To compute the correction q, choose a point of the colored plane as the root. On each line through it, subtract the root's color modulo three from the other two colors. The resulting unordered pair gives the line an index in the order 00,11,01,12,02,22. For two distinct lines through the root with indices i,j, take the entry Q_{ij} of the certificate matrix Q. The correction q is the mean entry over nine roots and six unordered pairs of lines per root.

The certificate expresses Q as a sum of positively weighted outer products, so p^\top Qp\ge0 for every vector p. Under the random affine map, conditional on the image of the root, the two line indices are independent draws from the same distribution p. Their mean matrix entry is then p^\top Qp. This explains why the correction has nonnegative expectation in the proof of (1).

The last row and column of Q are zero. The first five rows and columns of 3024Q are

\begin{pmatrix} 2912&-1584&1050&-1144&-336\\ -1584&3528&-594&1296&-1296\\ 1050&-594&882&-777&-522\\ -1144&1296&-777&2432&-336\\ -336&-1296&-522&-336&1296 \end{pmatrix}.
We assigned the three colors to the nine plane points in all possible combinations. In plane coordinates (x,y), fixing the value of x, y, x+y or x-y gives the lines in each of the four directions. If k_j of the three lines in direction j are monochromatic, the total number of monochromatic lines is M=\sum_j k_j=12m. The number of mixed ordered pairs is B=\sum_j k_j(3-k_j)=24b. Summing the scaled entries 3024Q_{ij} over the 54 rooted line pairs gives an integer U. Then S=(9M-4)3024-2U is 108\cdot3024 times the slack. We checked S\ge0 and 108\cdot3024 B\le14\cdot24 S on every coloring. Table 1 groups these exact comparisons by B.

To check the edit calculation independently, we formed lines by completing each pair of distinct points x,y with -x-y, counting each unordered line once. Six times the monochromatic line count plus N gives the ordered count including zero steps. Changing one point increased this count by 12, 30, 84 and 246 for N=27,81,243,729, respectively. Each increase equals N/3+3. On 81 points all 12,960 ways of changing two distinct points gave increases of 54, 60 or 66, within the predicted 54\pm12. The bound in arbitrary dimension follows from the pair count in (2).