GenerateRandomSearch

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

  1. Choose how many marks you want on the ruler.
  2. Search, and read where the marks fall.
  3. Check the list of distances — every one appears exactly once.
  4. 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.