TOPICS
Search

Sparse Ruler


A sparse ruler is a ruler of positive integer length n with marks at integer positions between 0 and n, including both endpoints, that measures every distance 1, 2, ..., n using the minimum possible number m(n) of marks. Distances may be measured more than once. Such rulers are similar to the type considered by Gardner (1985, pp. 65-67 and 261-262).

Consider a sparse ruler of length 13. Clearly, five marks wouldn't be enough since there are at most (5; 2)=10 differences between possible marks. On the other hand, six marks is enough, but because that gives (6; 2)=15 differences, there must be two repeats. An example of such a set of marks is {0, 1, 6, 9, 11, and 13}, which gives all distances up to 13, but includes distance 2 and 5 twice each (11-9 and 13-11; 6-1 and 11-6). In fact, no perfect sparse ruler, i.e., a sparse ruler that uniquely measures all distances up to its length, exists for five or more marks (Golomb 1972; Gardner 1983, p. 154).

Sparse rulers arise in the restricted representation of differences problem studied by Erdős and Gál (1948). Leech (1956) and Wichmann (1963) gave bounds and constructions. Modern computer analyses include Robison (2014) and Pegg (2020), but exact minimum mark counts remain unknown for many lengths.

An example sparse ruler can be given by the marks {0, 1, 2, 3, 27, 32, 36, 40, 44, 48, 52, 55, 58}, with consecutive differences between marks {1, 1, 1, 24, 5, 4, 4, 4, 4, 4, 3, 3}. A ruler like this having repeated values has a shortened form written as 1^324^15^14^53^2. This notation leads to the major W(r,s) and minor w(r,s) Wichmann constructions, where r and s are nonnegative integers and powers denote repetition of consecutive gaps:

 W(r,s)=1^r,r+1,(2r+1)^r,(4r+3)^s,(2r+2)^(r+1),1^r
 w(r,s)=1^r,r+1,(2r+1)^(r+1),(4r+3)^s,(2r+2)^r,1^r.

The maximal length for a Wichmann ruler with k segments (k+1 marks) is (k^2-(k (mod 6)-3)^2)/3+k for k>=2. For k=2, 3, ..., these have lengths 3, 6, 9, 12, 15, 22, 29, 36, 43, 50, 57, 68, 79, ... (OEIS A289761). An optimal sparse ruler has the greatest length for a given number of marks. Among known greatest lengths, the exceptions to attainment by Wichmann rulers are 1, 13, 17, 23, and 58 (OEIS A349978). This is an existence assertion and does not imply that every optimal sparse ruler is a Wichmann ruler. It is conjectured that for every number of marks greater than 13, a Wichmann ruler attains the greatest possible length (Saarela and Vanhatalo 2024, p. 10).

The excess of a sparse ruler is E(n)=m(n)-nint(sqrt(3n+9/4)), where nint is the nearest integer function. The recorded values for n=51, 52, ... begin 1, 0, 0, 0, 0, 0, 0, 0, 1, ... (OEIS A326499), with excess 0 for 1<=n<=50. For lengths above 213, some recorded values come from constructions whose minimality has not been proved. Exhaustive searches become increasingly expensive, and it has not been ruled out that E(n) could be negative for some large n.

The major and minor Wichmann constructions are simple modifications of each other, and most solutions can be modified in many ways. Pegg (2020) describes constructions which, for any length n>257992, use nint(sqrt(3n+9/4)) or nint(sqrt(3n+9/4))+1 marks. That makes sparse rulers unusual among problems in combinatorics in that the smaller (not larger) cases are the hardest to find, with the sparse ruler of length 1792 being particularly challenging.

DarkSatanicMillsOnACloudyDay

Plotting the excess values in batches of maximal Wichmann rulers leads to a pattern called "Dark Satanic Mills on a Cloudy Day" by N. J. A. Sloane. All the windows in the Dark Mill are Wichmann rulers. The pattern motivates conjectures about the optimality of Wichmann rulers, but does not establish the exact minimum mark count for every length.

A related maximum distinct differences problem fixes both the number of marks and an enclosing interval, and maximizes the number of distinct distances attained. Unlike a sparse ruler, an optimal configuration for this problem may leave some distances unmeasured (Pegg 2026).


See also

Dark Satanic Mills on a Cloudy Day, Golomb Ruler, Graceful Graph, Graceful Labeling, Maximum Distinct Differences, Ruler, Wichmann Ruler

Portions of this entry contributed by Ed Pegg, Jr. (author's link)

Explore with Wolfram|Alpha

References

Erdős, P. and Gál, I. S. "On the Representation of 1,2,...,N by Differences." Proc. Nederl. Akad. Wetensch. 51, 1155-1158, 1948. Also published as Indagationes Math. 10, 379-382, 1949.Gardner, M. Wheels, Life, and Other Mathematical Amusements. New York: W. H. Freeman, pp. 153-155, 1983.Gardner, M. The Magic Numbers of Dr Matrix. Buffalo, NY: Prometheus, pp. 65-67 and 261-262, 1985.Golomb, S. W. "How to Number a Graph." In Graph Theory and Computing (Ed. R. C. Read). New York: Academic Press, pp. 23-37, 1972.Granville, A. and Roesler, F. "The Set of Differences of a Given Set." Amer. Math. Monthly 106, 338-344, 1999. https://doi.org/10.1080/00029890.1999.12005050.Leech, J. "On the Representation of 1,2,...,N by Differences." J. London Math. Soc. 31, 160-169, 1956. https://doi.org/10.1112/jlms/s1-31.2.160. Pegg, E. Jr. "Sparse Rulers." Wolfram Demonstrations Project. 2019. https://demonstrations.wolfram.com/SparseRulers/. Pegg, E. Jr. "Wichmann-Like Rulers." Wolfram Demonstrations Project. 2019. https://demonstrations.wolfram.com/WichmannLikeRulers/.Pegg, E. "Hitting All the Marks: Exploring New Bounds for Sparse Rulers and a Wolfram Language Proof." 2020. https://blog.wolfram.com/2020/02/12/hitting-all-the-marks-exploring-new-bounds-for-sparse-rulers-and-a-wolfram-language-proof/.Pegg, E. Jr. Mathematical Games. Episode 6: "Sparse Rulers, Golomb Rulers & Difference Sets." Jul. 13, 2023. https://www.youtube.com/watch?v=6FxfRnQUVfQ. Pegg, E. Jr. "Excess01Ruler." Wolfram Function Repository. https://resources.wolframcloud.com/FunctionRepository/resources/Excess01Ruler/. Pegg, E. Jr. "Winners of the OEIS 400K Milestone Contest." Wolfram Community. Oct. 26, 2026. https://community.wolfram.com/t/28423.Robison, A. D. "Parallel Computation of Sparse Rulers." Intel Developer Zone. Jan. 14, 2014. https://web.archive.org/web/20160429004505/http://software.intel.com/articles/parallel-computation-of-sparse-rulers.Saarela, A. and Vanhatalo, A. "A Connection Between Unbordered Partial Words and Sparse Rulers." 29 Aug 2024. https://arxiv.org/abs/2408.16335.Sloane, N. J. A. Sequences A289761, A326499, and A349978 in "The On-Line Encyclopedia of Integer Sequences."Wichmann, B. "A Note on Restricted Difference Bases." J. Lond. Math. Soc. 38, 465-466, 1963. https://doi.org/10.1112/jlms/s1-38.1.465.

Referenced on Wolfram|Alpha

Sparse Ruler

Cite this as:

Weisstein, Eric W., with contributions by Ed Pegg, Jr.. "Sparse Ruler." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/SparseRuler.html

Subject classifications