All Tools
Categories
Number Tools 69 XML Tools 64 Email Marketing Tools 55 Import-Export Tools 50 JSON Tools 45 Text Tools 13 Shipping Freight Tools 5 Calculator 4
About Contact Privacy

Stanley Numbers Generator

Generate Stanley numbers - the greedy set S(0, 1) built so no three members ever form an arithmetic progression: 0, 1, 3, 4, 9, 10, 12, 13... BigInt, start index, Base-3 view, copy or download. Runs in your browser. Free.

Parameters
1 - 10,000
Greedy rule: admit the smallest candidate that completes no 3-term arithmetic progression with earlier members — before the base-3 digit pattern ever appears.
Sequence

          

About Stanley Numbers Generator

Take one greedy rule — never choose a number that completes a 3-term arithmetic progression with two numbers already chosen — and apply it forever, starting from 0 and 1. The result is the most touching sequence in additive combinatorics: 0, 1, 3, 4, 9, 10, 12, 13, 27, 28, 30, 31... — the numbers with only digits 0 and 1 in base 3, otherwise known as the Stanley sequence S(0, 1).

Stanley Numbers Generator runs the greedy construction itself: each candidate faces the midpoint test (a + b = 2c) and the endpoint test (c = 2a − b) against the growing set before admission. Choose a start index and count; each row shows the value and its base-3 digits, making the closure theorem visible term by term.

Features

  • True greedy construction: Every term admitted only after the 3-term arithmetic-progression test passes.
  • Base-3 on every row: The 0/1 digit rendering demonstrates the ternary closure theorem as terms appear.
  • Start anywhere: From index 0 to a million, up to 10,000 consecutive terms.
  • BigInt exactness: Hundreds of digits with zero rounding.
  • Copy or download: One click export of the full run as index = value lines.
  • Reference tab: The greedy proof, S(0, 1, 4) = S(0, 1) note, Odlyzko–Stanley remarks.
  • Free and private: All selection runs locally — nothing is uploaded, stored or logged.

How to Use

  1. Set the start index — which term to begin with (0 to 1,000,000).
  2. Set the count — consecutive terms to generate (1 to 10,000).
  3. Generate — the greedy rule runs against the chosen set and admits or rejects candidates.
  4. Inspect the base-3 digits — every value uses only 0 and 1.
  5. Copy or download — the complete run for analysis.

Examples

Example 1 — The greedy start. Count 10: 0, 1, 3, 4, 9, 10, 12, 13, 27, 28. Notice 2 is skipped because 0, 1, 2 form a progression with earlier members.

Example 2 — Midpoint and endpoint tests. Candidate 2 completes (0, 1, 2) as an end; candidate 5 is rejected because 3 = (1 + 5)/2 is already chosen, making (1, 3, 5). Each candidate faces both tests against the whole set.

Example 3 — Base-3 view. Generate 12 terms: the ternary forms read 0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011 — binary counting wearing base-3 clothing.

Example 4 — The closure check. Generate 16 terms and read the base-3 column: no digit 2 ever appears — the members are exactly the numbers whose ternary form uses only 0 and 1.

Example 5 — Large terms. Start 1000, count 5 — the values reach past a million with base-3 forms of 10+ digits, computed exactly by BigInt.

Benefits

  • Definition-faithful: The actual greedy rule runs; nothing is replaced by a shortcut.
  • Theorem on screen: The ternary digit-set closure is demonstrated term by term.
  • Flexible ranges: Start anywhere and take any run length up to 10,000.
  • Exact at scale: BigInt keeps greedy checks and values precise forever.
  • Structured output: Values plus base-3 digits export cleanly for further work.
  • Private by design: The greedy loop stays in the browser; nothing is uploaded or logged.

Frequently Asked Questions

What is a Stanley sequence?
A Stanley sequence starts with a finite seed and grows greedily: each new term is the smallest positive integer that does not create a 3-term arithmetic progression with two earlier members. The classic S(0, 1) is the most famous example.
What is so special about S(0, 1)?
Its closure is famously clean: the members are exactly the numbers whose base-3 digits are only 0 or 1 — 0, 1, 3, 4, 9, 10, 12, 13, 27, 28... In other words, the greedy closure of (0, 1) is the ternary digit set {0, 1}, a fact first observed by Odlyzko and Stanley.
How does the greedy rule work?
Every candidate is rejected if it completes the arithmetic progression with two numbers already chosen: as midpoint (a + b = 2c) or as an end (c = 2a − b). The generator checks both conditions against the whole chosen set before admitting a term.
What is the output?
One row per term: the index, the value, and the base-3 rendering whose digits are only 0 and 1. Copy and Download export clean index = value lines for any run.
Can I start from a late point?
Yes — the tool accepts a start index up to a million. Because the generated set is computed from the greedy rule, later terms stay exactly right even on such starts.
Are Stanley numbers the same as the Moser-de Bruijn numbers?
No. S(0, 1) closes on the base-3 digit set {0, 1}: 0, 1, 3, 4, 9, 10, 12, 13... The Moser-de Bruijn numbers are the base-4 digit set {0, 1}: 0, 1, 4, 5, 16, 17, 20, 21... Both are AP-free, but distinct — the site offers a generator for each.
Does the seed matter?
Seeding with 0, 1, 4 produces the same set as 0, 1 alone, because 4 is already admitted by the greedy rule: S(0, 1, 4) = S(0, 1). Other seeds lead to deep open problems.
Is anything stored or uploaded?
No. Greedy selection runs entirely in the browser. Nothing is sent to a server, saved or logged. Copy or download before closing the tab.