ForHosting KIT · Math

Look-and-say sequence

Read a string of digits aloud in runs and write down what you hear: starting from 1, the fifth term is 111221. Choose any seed and a term from 1 to 40 and see every step in between. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Seed
1
Which term to return
5
You get
Term
111221
Length
6
Sequence
1, 11, 21, 1211, 111221

The look-and-say sequence, popularized by John Conway, is generated by reading each term aloud as runs of identical digits: you count how many times a digit repeats and write that count followed by the digit itself. Starting from a seed such as one, the next terms become eleven, then twenty-one, then one two one one, then three ones two twos and one one, and so on. This calculator accepts any digit seed and a positive index n, iterates the run-length step exactly n minus one times, and returns the n-th term together with its length and the full intermediate sequence. Values of n below one are rejected with a clear validation error so homework checkers and automated tests can rely on stable failure semantics as well as stable success output.

What the look-and-say sequence is and why it matters

Look-and-say is a pure string process on digits rather than a closed arithmetic formula. Begin with a seed string made only of characters zero through nine. To obtain the next term, scan the current string from left to right, group consecutive equal digits into maximal runs, and for each run append the decimal length of the run and then the digit that formed it.

For example the seed one becomes one one because there is a single one; that becomes two one because there are two ones in a row; that becomes one two one one; that becomes one one one two two one; and that becomes three one two two one one. The process is deterministic, invertible only in limited ways, and famous for Conway’s constant: asymptotically the length of successive terms multiplies by about one point three on average for almost all seeds.

Students meet the sequence in discrete-mathematics courses, coding interviews that ask for a generate-the-next-term function, and recreational number-theory articles about audioactive decay. Teachers use small seeds and modest n as worked examples because each step is checkable by hand yet the strings grow quickly enough to reward careful implementation.

How this calculator builds the n-th term

Call the capability with two required fields: seed, a non-empty string of digits, and n, a positive integer from one through forty. The engine validates that both fields are present, that seed contains only digits and stays within the published length limit, and that n is a finite integer not below one and not above the maximum. After validation, term one is defined to be the seed itself.

For each subsequent index the core applies a pure run-length encoding pass that never uses the network, clocks, or randomness. Intermediate strings are retained so the response can return not only the final term and its character length but also the ordered sequence from term one through term n.

Homework and contest verification

Students and graders confirm the n-th look-and-say term from a given seed and inspect intermediate terms without writing a local script.

Teaching run-length encoding with Conway’s sequence

Lesson pages that introduce audioactive decay can show each spoken run step beside the growing digit string so learners connect RLE to the classic series.

What happens if n is below 1?

Only positive integers n ≥ 1 are accepted; zero and negatives are rejected and not charged.

Is term 1 the seed itself?

Yes. n is 1-based: when n equals 1 the returned term is exactly the seed; larger n applies run-length encoding n−1 times.

Is the look-and-say sequence calculator free?

The browser tool runs free on your device.

What seed formats are accepted?

A non-empty string of digits 0–9 within the published length limit.

Why do look-and-say terms get longer so quickly?

Each term describes the one before it, and that description usually needs more digits than what it describes. For almost every seed the length grows by a factor of about 1.3 per step, a figure known as Conway's constant.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/math/look-and-say

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/math/look-and-say \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"seed":"1","n":5}'
{
  "seed": "1",
  "n": 5
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "math.look_and_say",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_n40
max_seed_len64
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

How this calculator builds the n-th term

Missing seed, non-digit characters, empty strings, zero, negatives, non-integers, and oversized n all fail with invalid_input and are not charged.

Practical use, limits, pricing, and delivery

Use the browser tool when you want an immediate look-and-say expansion while studying run-length encoding, checking a contest answer, or demonstrating Conway’s sequence without installing a computer-algebra system. Results are fully deterministic: the same seed and n always yield the same term, the same length, and the same sequence list. There is no language model, no external arithmetic service, and no randomness, so the capability is safe to pin in continuous-integration checks and reproducible lesson materials. Each successful request is one billable item at $0.002; failed validation does not consume balance. Wire the endpoint into coding-interview sandboxes, discrete-math tutorials, string-algorithm demos, or any pipeline where you already prefer exact run-length look-and-say steps over opaque black-box calculators that cannot show intermediate terms.

Interview and coding-exercise oracles

Practice platforms can call a deterministic oracle that returns term and sequence for valid seed and n and rejects n below 1 with a stable error code.

How do I generate the n-th look-and-say term with this API?

Send a JSON body with digit string field seed and positive integer field n to math.look_and_say. The response returns term, length, and the full sequence from 1 through n.

Read the full KIT documentation →