Golomb Ruler Generator
Put marks on a ruler so that no two pairs are the same distance apart. Four marks fit into six units; five need eleven; six need seventeen. The lengths grow much faster than the marks do, and nobody has found a formula — the shortest ruler for a given number of marks is known only because somebody searched for it, and beyond about twenty-five marks nobody has finished searching.
What this generator does
Searches lengths from the shortest upwards, and for each one tries every way of placing the marks, stopping at the first length that admits an arrangement with no repeated distance.
How to use this tool
- Choose how many marks you want on the ruler.
- Search, and read where the marks fall.
- Check the list of distances — every one appears exactly once.
- Add a mark and watch the length jump.
Understanding the controls
- How many marks
- Three to eight. Eight takes about a second because every shorter length must be ruled out completely before it can be called shortest.
Common use cases
- Spacing radio telescope dishes so every baseline is different
- Placing sensors so no two pairs share a separation
- Designing conflict-free channel assignments
- A concrete example of a problem with no known formula
- Puzzle material for a maths club
How this generator works
Because the search works upwards from the shortest possible length, the first arrangement found is the shortest one that exists — every shorter length has already been exhausted. Before the answer is shown, all the distances between pairs are recomputed and tallied, so a repeat would be reported rather than shipped.
Randomness and fairness
Nothing is random. The same number of marks always gives the same ruler, since the search is exhaustive and ordered.
For how randomness is produced across the whole site, see how Generate Random works.
Limitations and good to know
- Three to eight marks. Beyond that the search grows fast enough that finding the shortest becomes a serious computation.
- One arrangement is shown, though several of the same length often exist.
- The marks are whole units apart; rulers with fractional marks are a different problem.
- Reversing or shifting a ruler gives the same ruler, and those are not listed separately.
Privacy and your data
The search runs entirely in your browser. Nothing is transmitted or stored.
Related generators
- Langford Sequence GeneratorTwo of each number arranged so the two 3s have three things between them, and so on — which only works for some counts.
- Steiner Triple System GeneratorSplits a group into threes so that every pair of people ends up together exactly once — possible only for certain sizes.
- Graeco-Latin Square GeneratorTwo Latin squares laid over each other so that every combination of symbols appears exactly once — impossible at six, as Euler found.
- Magic Square GeneratorBuilds a genuine magic square of any size — every row, column and diagonal summing to the constant the size forces.