# A sum of gap lengths tells when a ruler can reach the length predicted by counting pairs

How closely can you pack marks at whole-number positions on a ruler if only a limited number of pairs may have the same spacing? Counting pairs one unit apart gives a length below which the marks cannot fit. The difficulty is deciding whether the marks can actually fit: an arrangement that meets the limit at one spacing can exceed it at another.

We find the exact point at which the counting bound becomes attainable. Call the maximum number of pairs allowed at any one spacing the repetition limit, and let \(b\) be the number of marks minus that limit. With four extra marks, the first limit that works is four. Eight marks then fit on a ruler of length ten. For every \(b\ge2\), the threshold is the sum of the first \(b\) entries of \(2,3,3,4,4,4,5,5,5,5,\ldots\), minus \(2b\). Every larger limit also works with the same number of extra marks. The key is to choose which positions to leave empty. An empty position in the interior can break a pair on either side; near an end, one of those pairs may already be missing.

## 1. The length bound and when it is reached

A ruler is a finite set of integer marks; its diameter is the distance between its outermost marks. For a set of marks \(X\), the number of pairs separated by a positive distance \(d\) is
\[
r_X(d)=\#\{x\in X:x+d\in X\}\quad(d>0).
\]
A ruler with repetition limit \(g\), called a \(g\)-Golomb ruler, satisfies \(r_X(d)\le g\) at every positive distance. Ordinary Golomb rulers have \(g=1\), so every spacing is distinct. Write \(G(g,n)\) for the smallest diameter with \(n\) marks. We consider \(n=g+b\), with \(b\ge2\). A fully marked interval of diameter \(D\) has \(D\) pairs one unit apart. Leaving \(D+1-n\) positions empty removes at most two such pairs per empty position. Thus \(r_X(1)\ge 2n-D-2\), giving
\[
G(g,g+b)\ge g+2b-2.
\]
The first-attainment threshold \(g_0(b)\) is the least positive integer \(g\) for which equality holds.

We choose the empty positions using a second kind of ruler. A linear-multiplicity (LM) ruler allows at most \(d-1\) pairs at distance \(d\). Each gap between consecutive marks must therefore have length at least two, and at most \(s-1\) gaps can have length \(s\). Let \(B(n)\) be the sum of the first \(n-1\) terms of
\[
2,\ 3,3,\ 4,4,4,\ 5,5,5,5,\ldots.
\]
Adding these shortest permitted gaps gives a lower bound on the diameter of an LM ruler with \(n\) marks.

Gupta and O’Bryant [3] study how short rulers can be when many pairs may share a spacing. Ariel Williams [1] found how the first-attainment threshold grows for large \(b\), tabulated its first 12 values and asked for its exact value. In a separate paper, Williams [2] gave lists of adjacent gaps, called AW schedules, that attain \(B(n)\) for every size \(n\). We rearrange these gaps and use the internal marks of the resulting sparse ruler as the empty positions, or holes, in a dense one. The sum of the gaps fixes the length. Their order determines how many pairs the holes remove at each spacing.

For every integer \(b\ge2\), the exact threshold is
\[
g_0(b)=B(b+1)-2b.
\]
To evaluate the sum, let \(k\) be the largest gap among its terms and \(r\) the number of copies of that gap. These are the unique integers \(k\ge3\) and \(1\le r\le k-1\) with
\[
b=\binom{k-1}{2}+r.
\]
Then
\[
g_0(b)=\frac{(k-1)(k-2)(k-3)}3+(k-2)r.
\]
The construction gives a ruler at the threshold for each \(b\). To increase \(g\) while keeping \(b\) fixed, add a mark one unit beyond the right endpoint. This increases the diameter by one and adds at most one pair at each spacing, so equality persists.

For example, \(b=4\) gives \(k=4,r=1\), so the threshold is \(g=4\). The sparse ruler has successive gaps \((3,2,3,4)\), with marks \((0,3,5,8,12)\). Removing its internal marks from the integers 1 through 11 gives \((1,2,4,6,7,9,10,11)\), an eight-mark ruler of diameter ten with no spacing repeated more than four times.

## 2. Why a smaller repetition limit cannot work

If a ruler reaches the length bound, its holes, together with two points just outside the ruler, must form an LM ruler. The length needed for those points gives a lower bound on the repetition limit.

Suppose a \(g\)-Golomb ruler \(X\) with \(g+b\) marks has diameter \(D=g+2b-2\), with endpoints 0 and \(D\). Let \(J\) be its set of \(b-1\) holes. To count pairs at distance \(d\), start with the whole interval and remove pairs that touch a hole. Subtracting two pairs per hole overcounts the losses in two ways. It subtracts a pair joining two holes twice, and it subtracts a nonexistent pair when a hole has no partner on one side. Adding back these counts gives, for \(1\le d\le D\),
\[
r_X(d)=g+1-d+r_J(d)+\#\{j\in J:j<d\}+\#\{j\in J:j>D-d\}.
\]
Since \(r_X(d)\le g\), the number of hole pairs at distance \(d\) plus the two counts of holes near the ends is at most \(d-1\).

Adjoin outside points \(-1,D+1\) to \(J\). Each new endpoint-to-hole pair of distance \(d\le D\) is included in the corresponding boundary count above. At distance \(D+1\) there are no pairs; at distance \(D+2\) there is just the outside-endpoint pair. Thus the augmented set is an LM ruler with \(b+1\) marks and diameter \(D+2\).

In any LM ruler, at most \(s-1\) adjacent gaps can have length \(s\), and no gap has length one. Minimizing their sum gives diameter at least \(B(b+1)\). Therefore
\[
g+2b=D+2\ge B(b+1).
\]
Subtracting \(2b\) gives the claimed lower bound on the repetition limit.

## 3. The construction and its boundary requirement

To reach the bound, we build a sparse ruler of length \(B(b+1)\) and use its internal marks as holes. The smaller gaps follow a common ordered list, called the body. We use three arrangements of the body and the copies of the largest gap \(k\). How we place the ends depends on whether the largest gap occurs once or several times.

Write \(k=2h+1+\eta\), where \(\eta\in\{0,1\}\), call \(h\) the height, and put \(H=h+1\). The body \(W\) from [2] consists of shorter lists called rows. Join them in order of decreasing row index, \(a=h-1+\eta,\ldots,1\). For odd \(k\), start each row with a gap \(H\). Within row \(a\), append
\[
(H+a,\ H+\eta-j,\ H+a,\ H+j),\qquad j=1,\ldots,a.
\]
For even \(k\), omit the fourth gap of the last block of each row. For odd \(k\), append one final gap \(H\) after all rows, including when there are no rows. The body contains \(s-1\) gaps of each length \(2\le s<k\).

Write \(k^t\) for \(t\) copies of the gap \(k\). The full list of gaps (the gap word) is as follows:

1. If \(r\ge2\), use \((k,W,k^{r-1})\).
2. If \(r=1\) and \(k\) is even, use \((W,k)\).
3. If \(r=1\) and \(k\) is odd, move the first gap of \(W\) to its end, then append \(k\).

Starting at zero, add each gap in turn and let \(A\) be the set of positions visited. Let \(L=\max A=B(b+1)\), and let \(J=A\setminus\{0,L\}\). Set
\[
X=\{1,\ldots,L-1\}\setminus J,\qquad g=L-2b.
\]
There are \(g+b\) marks in \(X\), and its endpoints are 1 and \(L-1\), since every gap is at least two. Its diameter is \(L-2=g+2b-2\).

Count the holes within distance \(d\) of each outside endpoint, counting a hole twice if it is near both:
\[
E(d)=\#\{j\in J:j\le d\}+\#\{j\in J:L-j\le d\}.
\]
In terms of this boundary count, the pair formula from Section 2 becomes
\[
r_X(d)=g+1-d+r_J(d)+E(d).
\]
It therefore suffices to prove
\[
r_J(d)+E(d)\le d-1. \tag{1}
\]
Only distances \(1\le d\le\min(L-2,2b-1)\) need checking. At \(d\ge2b-1\) even marking every position from 1 through \(L-1\) would give at most \(g\) pairs.

### Bounding the counts of hole pairs and holes near the ends

To bound the hole pairs we compare them with pairs on a ruler whose counts Williams [2] studied. Let \(F_k\) be the unmodified full AW ruler, with word \((W,k^{k-1})\), and let \(n_k=1+\binom{k}{2}\) be its number of marks.

For \(r\ge2\), translating \(J\) by \(-k\) places its marks at the beginning of \(F_k\). For even \(k\) with \(r=1\), the holes already lie in \(F_k\) without translation. For odd \(k\), \(r=1\), write the positions reached by the successive body gaps as \(0=p_0,p_1=H,\ldots,p_m=T\). Translation by \(H\) gives
\[
J+H=\{p_2,\ldots,p_m,T+H\}.
\]
Thus there is at most one point outside \(F_k\). One extra point creates at most two pairs of any fixed positive distance, so in all cases
\[
r_J(d)\le r_{F_k}(d)+2. \tag{2}
\]

Every two consecutive gaps in each modified word sum to at least \(k+1\). The ordering of larger and smaller gaps in [2] gives this bound within the body. The only new adjacency within the rotated body is \((H,H)\) in the odd case, with sum \(k+1\). To reach the \(q\)th hole from an outside endpoint takes \(q\) gaps. Grouping successive gaps in pairs shows that the distance is at least \(\lfloor q/2\rfloor(k+1)\). Applying this at both ends yields
\[
E(d)\le\frac{4d}{k+1}+2\le\frac{2d}{H}+2.
\]
Together,
\[
r_J(d)+E(d)\le r_{F_k}(d)+\frac{4d}{k+1}+4. \tag{3}
\]
Thus for a given \(k\), a bound on the full ruler’s pair count serves for every choice of \(r\).

## 4. Short distances

At short distances a pair spans only one or two gaps. For heights \(h\ge2\) we can therefore count pairs directly from the order of the gaps. Section 7 gives the direct check for height one.

For \(d\le k\), no pair of consecutive gaps can sum to \(d\). The gaps between consecutive holes are the prescribed gaps except for the first and last. In the formulas below, brackets equal one if the enclosed condition holds and zero otherwise. When \(r\ge2\), those removed gaps are both \(k\), and \(E(d)=2[d=k]\). When \(r=1\), the removed gaps are \(k-1,k\), and \(E(d)=[d\ge k-1]+[d\ge k]\). In either case (1) follows immediately by adding the boundary count to the number of remaining gaps of length \(d\), including at \(d=k\).

For \(k<d\le3h\), the short-distance lemma in [2] counts pairs in the full ruler by counting runs of two successive gaps. With \(d=2H+t\), the counts for odd \(k\) are
\[
r_{F_k}(2H)=2h-2,\qquad
r_{F_k}(2H+t)=2h-1-t\quad(t\ge1).
\]
The count for even \(k\) is at most \(2h\). In the two cases where a translate of the holes lies entirely in the full ruler, \(E(d)=2\), and these bounds prove (1).

In the rotated odd case, joining the last and first body gaps adds a two-gap run of length \(2H\). Removing the initial gap from the list of gaps between holes removes a run of length \(3h\). No new run of three gaps has sum at most \(3h\). Hence
\[
r_J(d)=r_{F_k}(d)+[d=2H]-[d=3h],\qquad
E(d)=2+[d=3h].
\]
At \(d=2H\), the sum is exactly \(2h+1=d-1\). At the remaining distances the odd formula again gives (1). At \(3h\), the lost run offsets the extra hole counted near the boundary. This is why the rotation works when there is one largest gap and \(k\) is odd.

## 5. Middle distances

At middle distances the question is how far the full ruler’s pair count falls below the allowed count. The difference must cover the extra terms in (3). For \(h\ge151\) and \(3h<d<200h\), [2] gives rational upper bounds for \(r_{F_k}(d)/h\). Each pair spans a run of consecutive gaps. The proof groups runs by location: within a row, across adjacent rows, at the end of the word, or across multiple row boundaries. Every relevant run has at most 199 gaps. Williams bounds the counts separately for odd and even \(k\), on each of 1,576 intervals, or bands, of distance divided by height:
\[
u=d/h\in[j/8,(j+1)/8],\qquad 24\le j\le1599.
\]
At the distances \(d=2k,3k,4k\), some runs can contribute extra pairs. Williams gives separate bounds for these three lines for odd and even \(k\).

For a given parity of \(k\), let \(M_j\) be the published upper bound on \(r_{F_k}(d)/h\) in band \(j\). To compare counts on the same scale, divide the extra terms in (3) by the height. Since \(H>h\), they contribute at most
\[
\frac{2u+4}{h}\le\frac{2(j+1)/8+4}{151}.
\]
On band \(j\), the allowed count \((d-1)/h\) is at least \(j/8-1/151\). Subtracting the published bound and the extra terms leaves a strictly positive margin even on the tightest band:
\[
\min_{\text{both parities},j}
\left(\frac j8-\frac1{151}-M_j-\frac{2(j+1)/8+4}{151}\right)
=\frac{10}{453}>0. \tag{4}
\]
The minimum occurs at \(j=48\) for both parities. This establishes (1) off the three exceptional lines.

Each exceptional distance can be written as a line \(d=sh+c\) in the height \(h\), with fixed coefficients \(s,c\). To allow for the boundary terms, subtract \((2(s+c/151)+4)/151\) from the published line margin. All six remaining margins are positive; the smallest is \(16447/68403\), on the odd \(2k\) line. The proof in [2] rules out intersections with other lines on which individual runs contribute extra pairs at \(h\ge151\). Thus these cases also satisfy (1).

All 3,158 subtractions were evaluated as exact fractions. A separate implementation supplied with [2] regenerated the list of runs contributing to the bounds, checked the inputs against their digital fingerprints (hashes), and reproduced every band and exceptional-line upper bound. The grouping of runs in [2] makes these bounds apply at every height in this range.

## 6. Long distances

At long distances, we need only an upper bound on the number of pairs in the full ruler. We extend the four-progressions lemma of [2], which counts pairs using evenly spaced groups of marks, to twice its original distance range. For the full AW ruler the original lemma gives
\[
r_{F_k}(d)\le\frac{2d}{3}+\frac{182H}{3},\qquad d<n_k. \tag{5}
\]
The extended bound is
\[
r_{F_k}(d)\le\frac{2d}{3}+\frac{278H}{3},\qquad d<2n_k. \tag{6}
\]
To verify the change in constant, use the same partition of row marks into four arithmetic progressions (lists of equally spaced marks) with steps between \(4H\) and \(6H\). Pairs involving marks outside these progressions contribute at most \(6H\); unequal-step pairs within a row contribute at most \(8H\); equal-step pairs within rows contribute at most \(2d/3+44H/3\). These parts do not use \(d<n_k\).

For distinct rows \(a>c\), there are at most \(2H\) interacting ordered row pairs and sixteen choices of one progression from each row. These choices are called phase pairs. If \(q\) is the greatest common divisor of the two steps, [2] bounds the span of possible matches in units of the spacing between matching indices:
\[
\frac{(c-1)q}{4H}
\le\frac{3c}{4H}+\frac{d}{8H^2}.
\]
Successive matches are at least one unit apart on this scale. For the original distance range the upper bound was less than one. Since \(c<H\), \(n_k<2H^2\), and now \(d<2n_k\), it is less than \(3/4+1/2<2\). Thus each phase pair has at most two matches instead of one. The distinct-row contribution is at most \(64H\), replacing \(32H\). Adding the four contributions proves (6).

For \(200h\le d<n_k\), (3) and (5) prove (1) provided
\[
d(H-6)\ge182H^2+15H.
\]
At \(d=200(H-1)\), the left side minus the right side is
\(18H^2-1415H+1200>0\) for \(H\ge152\).

For \(n_k\le d<2n_k\), use (6) instead. Since
\(n_k\ge2H^2-3H+2\), the corresponding difference is at least
\[
(H-6)(2H^2-3H+2)-278H^2-15H
=H^2(2H-293)+5H-12>0
\]
for \(H\ge152\). All remaining relevant distances are below \(2b\le2(n_k-1)\). This completes the analytic argument at every height \(h\ge151\).

## 7. Finite cases and independent checks

To cover heights below 151, we counted pairs using integer arithmetic. For each of the 300 full AW words at heights \(1\le h\le150\), we counted every pair difference through \(2(n_k-1)-1\). At each \(d>3h\), we tested the integer inequality
\[
(k+1)(d-1-r_{F_k}(d)-4)-4d\ge0.
\]
This tests whether the upper bound in (3) is at most \(d-1\). It settled all distances tested above height 26. For each unresolved distance we built the adjusted word for every permitted number of largest gaps and checked (1) exactly. We also checked short distances directly at height one. The enumeration used 1,553,762,943 additions to the pair counts. All 1,538 direct checks of an arrangement at a particular distance passed. Together with the short-distance argument in Section 4, these counts cover every height below 151.

An independent implementation counted pairs on the dense rulers themselves. It recorded each position as a bit indicating whether a mark was present. At distance \(d\), the number of positions marked in both the original pattern and a copy shifted by \(d\) is exactly the pair count. Every relevant distance passed for every \(2\le b\le1431\). For heights 27 through 150, the independent implementation also reconstructed the full ruler's counts by summing consecutive gaps in batches. All 248 words satisfied the sufficient bound.

Table 1 includes additional checks on dense rulers at heights 151, 152 and 237. These covered both parities of \(k\) and \(r=1,2,k-1\). For each ruler we checked all short distances, distances near the exceptional lines, endpoint distances and 100 random draws made with a fixed seed.

| Check | Coverage | Result |
|---|---|---|
| Published middle-distance bounds after boundary adjustment | 3,152 bands, both parities | Smallest normalized margin: 10/453 |
| Exceptional middle-distance lines | Six lines | Smallest normalized margin: 16447/68403 |
| Finite full-word pair counts | 300 words at heights 1–150; 1,553,762,943 pair increments | Bound (3) suffices at every height 27–150 |
| Direct boundary checks where needed | 1,538 arrangement–distance cases, heights 1–26 | All pass |
| Independent checks of (3) on full words | 248 words, heights 27–150 | All pass |
| Independent counts on dense rulers | 1,430 rulers, b = 2–1,431; 2,047,760 distances | All pass |
| Checks on larger dense rulers | 18 rulers at heights 151, 152 and 237; 11,942 distances | All sampled distances pass |

Table 1. Verification coverage. A positive normalized margin means that the published difference-count bound, plus the new boundary contribution, remains below the allowed count after division by height. The last row is a sampled control, whereas the preceding row checks every relevant distance.

### Comparison of gap arrangements

For largest gaps \(k=3,\ldots,48\) and every \(b=2,\ldots,1128\), we compared 19,550 ways of splitting the largest gaps between the two ends of the unchanged body. These arrangements attained the bound for 1,105 of the 1,127 values of \(b\). All 22 misses had one largest gap and odd \(k\). Testing 16,742 arrangements with rotations of the body gave a solution for each of those 22 values. The arrangement counts include equivalent rulers.

## 8. Methods and scope

We used the public construction and proof supplements of [1,2], downloaded on 19 November 2026, and retained their source hashes. All arithmetic used to certify bounds was integer or rational. The finite enumeration, written in C++17, counted pairs by their starting and ending marks. The independent implementation, written in Python using the NumPy numerical library, rebuilt the gaps and summed runs of each possible number of consecutive gaps. Its checks on dense rulers used shifted bit patterns as described in Section 7.

Checking the boundary allowance separately for each distance band, rather than using one worst-case allowance, keeps the height cutoff at 151. Exhaustive counts complete the proof below that cutoff.

The threshold is a computer-assisted result. It relies on the proof in [2] that the groups of runs cover every possibility and has not been formally verified in a proof assistant. The shortest diameter immediately below the threshold remains open here.

## References

[1] Ariel Williams. *The sharp asymptotic diameter of linear-multiplicity rulers*. Version 2, 19 November 2026. https://doi.org/10.5281/zenodo.24363243. Section “The threshold for high-multiplicity rulers.”

[2] Ariel Williams. *Closing the Gaps with the AW Schedules: The Exact Minimum Diameter of Linear-Multiplicity Rulers*. Version 1, 19 November 2026. https://doi.org/10.5281/zenodo.24362078. Gap schedules, short- and long-distance lemmas, middle-distance appendices, and public proof supplement (CC BY 4.0).

[3] Aditya Gupta and Kevin O'Bryant. *Optimal Diameters of High Multiplicity g-Golomb Rulers*. arXiv:2605.14229v2, 9 November 2026. https://arxiv.org/abs/2605.14229. Section 7, Problem 4.
