EditSafely

Rewrite Numbers

Given numbers and a grammar, recursively rewrite them.

Runs on your device, nothing uploaded

Rules
Rabbit 1=12, 2=1 · Thue-Morse 0=01, 1=10 · Cantor 1=101, 0=000 · Fibonacci word 0=01, 1=0
Rewrite rules (one digit=replacement per line)One rule per line: digit=replacement. A rule may rewrite any character, not only digits.
Iterations
One numbered line per step: 0: 1, 1: 12, 2: 121.
Try:

0 chars · 0 lines

Output

Given numbers and a grammar, recursively rewrite them.

Type or paste above to see the result here.

Example: Rabbit sequence rules (1=12, 2=1) for 3 iterations

What you paste never leaves this tab

Rewrite Numbers is JavaScript that your browser has already downloaded, and it does the whole job on your own machine. On a normal site, whatever you type in is sent to a server that can log it, cache it or keep it. Here it is read and transformed inside this tab and nowhere else.

  • No upload
  • No length limit
  • Works offline once loaded
  • Nothing stored or logged

How to use Rewrite Numbers

  1. 1. Paste the starting digits. Enter the initial digit string in the input pane, for example a single 1 as the axiom of an L-system. This is the seed that every rewrite rule below gets applied to.
  2. 2. Define rewrite rules and iterations. Tap a Rules chip such as Rabbit or Thue-Morse, or choose My rules and list one digit=replacement pair per line, such as 1=12 and 2=1. Set Iterations to how many times the rules should be applied in sequence, since each pass can grow the string a lot.
  3. 3. Watch the string grow. Every digit in the current string is looked up against your rules and replaced simultaneously, then the result becomes the input for the next iteration until the count is reached. Turn on Show every generation to see each step on its own numbered line, with the final length and growth per step below.
  4. 4. Copy the final sequence. Copy the resulting digit string from the output pane. Lower the iteration count first if you only want to inspect an early generation rather than the fully expanded sequence.

When to use Rewrite Numbers

Rewrite Numbers applies a Lindenmayer-style substitution grammar to a digit string, replacing each digit with a rule-defined sequence over repeated iterations. It is built for exploring how simple digit rules produce rapidly growing, self-similar sequences.

  • Reproducing the rabbit sequence. The classic Fibonacci rabbit problem uses rules 1=12 and 2=1 starting from 1. Run three iterations here to get 12112 and confirm it matches what a textbook or paper describes.
  • Prototyping an L-system before drawing it. You are building a turtle-graphics fractal and want to see the raw symbol string a rule set produces at each generation before wiring it up to an actual renderer.
  • Exploring digit-substitution puzzles. A recreational math forum poses a rule like 0=01 and 1=0 and asks what the string looks like after ten steps. Enter the rule and iteration count to get the answer directly.
  • Teaching recursive substitution. You are showing students how a small set of replacement rules can generate long, structured sequences from a single starting symbol, and want a live example they can tweak themselves.

Examples

Rabbit sequence rules (1=12, 2=1) for 3 iterations

Input

1

Output

12112

Digits without a rule stay unchanged

Input

102

Output

121120121

Thue-Morse rules, every generation

Input

0

Output

0: 0
1: 01
2: 0110
3: 01101001

About the Rewrite Numbers tool

Rewrite Numbers runs as plain JavaScript in your browser tab, with no server behind it. Given numbers and a grammar, recursively rewrite them. Whatever you put in stays on your device from start to finish.

The tool is part of EditSafely's Number Tools section, 194 single-purpose utilities built around the same idea: open the page, get the result, keep your data to yourself.

You can shape the output with 4 settings, including Rules, Rewrite rules (one digit=replacement per line), Iterations and Show every generation, and the result refreshes the moment you change one. 3 worked examples further down the page show exactly what the tool produces for real inputs.

That local-first design has practical benefits beyond privacy. The tool keeps working on a flaky connection once the page has loaded, results are instant because nothing round-trips to a server, and it is safe to use with confidential material.

Frequently asked questions

Does Rewrite Numbers cost anything?

Yes, it is completely free. All 2,943 tools on EditSafely work without an account, a subscription or usage limits.

Is it safe to paste sensitive or confidential data?

No data leaves your device. The whole tool is JavaScript that runs inside your browser tab, so there is no upload, no server-side processing and no log of what you did. If you disconnect from the internet after the page loads, it keeps working.

How much text can I process at once?

There is no fixed limit; your device's memory is the ceiling. Up to 10 MB the result updates as you type, after a short pause that grows with the size. Above 10 MB a Run button appears so typing stays smooth, and files open up to 50 MB. A very long result shows its first 2,000 lines on screen, while Copy and Download always include all of it.

Do I need to sign up or install anything?

Nothing to install and no account needed. Open the page in any up-to-date browser, including on a phone or tablet, and the tool is ready.

How do I use the result?

The output panel has a one-click copy button, and you can keep refining the input while you work; the result updates in place as you type.