Free Online Utility • Interactive Fractal Studio • 2× HiDPI + SVG Engine

Generate a Dragon String

Generate Heighway Dragon, Twin Dragon, and Terdragon L-System strings and paper-folding turn sequences (R/L, 1/0, F/+/-) across Orders 1 to 12 with synchronized live curve preview.

Folding Order (n)6
Mathematical Specification Fractal Studio
Heighway Dragon L-System: Axiom FX | X → X+YF+ | Y → -FX-Y
Bitwise k-th Turn Formula (k ≥ 1):
Write k = m · 2^r (m odd) → Turn = ((m & 3) == 1) ? 'R' : 'L'
Total Segments = 2^n  |  Total Crease Turns = 2^n − 1
OEIS SequenceA014577 (Regular Paper-Folding)
Segments / Turns2^n segments, 2^n − 1 turns
Recursive RuleS_n = S_{n-1} + R + rev(inv(S_{n-1}))
SEQUENCE / STRING + LIVE CURVE PREVIEW
Generate a Dragon String

        
Synchronized Math + Visual Fractal Engine Instant

Session Calculation Log

No entries recorded in this session yet.

Mathematical Foundations of Generate a Dragon String

The Dragon String encodes both the Lindenmayer rewriting grammar (FX with X → X+YF+, Y → -FX-Y) and the famous OEIS A014577 Regular Paper-Folding Sequence produced by repeatedly folding a strip of paper in half in the same direction and recording each valley (R / 1) and mountain (L / 0) crease.

Self-similar fractals exhibit recurring geometric structure across scales, governed by Iterated Function Systems (IFS), Lindenmayer L-System rewriting rules, or recursive spatial subdivisions. Every geometry calculation, 2× HiDPI canvas pass, progressive animation frame, and lossless SVG vector export executes natively inside your browser at 60 FPS with zero server latency.

Recursive Mirror-Inversion & Bitwise Formula

Recursive Turn Rule:
  T_1 = R
  T_n = T_{n-1} + "R" + reverse(invert(T_{n-1}))
Direct O(1) Bitwise Rule for k-th crease (1-indexed):
  Strip trailing zeros of k: m = k / (k & -k)
  Crease_k = ((m & 3) === 1) ? "R" (1) : "L" (0)

Because the middle crease of every fold is always R and the second half is the reversed complement of the first half, the Dragon String is an iconic 2-automatic sequence that never becomes periodic yet has zero topological entropy.

Iteration Scaling & Complexity Table

Iteration / SettingElements / SizeGeometric Property
Order 11 turn (2 segs)R ( Binary: 1 )
Order 23 turns (4 segs)R R L ( Binary: 110 )
Order 37 turns (8 segs)R R L R R L L ( Binary: 1101100 )
Order 415 turns (16 segs)RRLRRLL R RRLLRLL
Order 101,023 turns (1,024 segs)Full 10-fold paper-crease word

Applications in Science, Graphics & Engineering

Automata Theory & Number Theory

The binary paper-folding sequence 110110011100100... is a benchmark 2-automatic sequence whose generating series is transcendental.

Pen Plotters & Turtle Graphics

Export Clean Turtle Commands (F/+/-) to plot Heighway, Twin, or Terdragon curves in Python or SVG engines.

Origami & Mechanical Metamaterials

Predict exact mountain/valley crease assignments before laser-scoring folded origami structures.

Pseudorandom Sequence Testing

Test compression algorithms on low-complexity, non-periodic symbolic sequences.

Interactive Controls, Pan/Zoom & Vector Export

Switch between Heighway Dragon, Twin Dragon, and 120° Terdragon grammars, output R/L creases, 1/0 binary bits, or full L-System tokens, and verify the live synchronized dragon curve.

Export crisp 2× Retina PNG renders for presentations or scalable infinite-resolution SVG files directly into Illustrator, Figma, Inkscape, LaTeX, or laser-cutting workflows.

Frequently Asked Questions

How do you find the k-th turn of a Dragon curve without generating the whole string?
Divide k by the highest power of 2 that divides it to get an odd integer m; if m mod 4 == 1 the turn is R (1), and if m mod 4 == 3 the turn is L (0).
Why are there 2^n - 1 turns in an Order n Heighway Dragon?
Folding a strip of paper in half n times divides it into 2^n segments separated by 2^n - 1 interior crease hinges.
What is the difference between Heighway Dragon and Terdragon strings?
Heighway Dragon uses 90-degree turns with 2^n segments, while the Terdragon uses the 120-degree rule F -> F+F-F with 3^n segments.
Can I export the binary paper-folding sequence (1/0)?
Yes. Select Binary Paper-Folding Sequence (1 / 0) and click Copy or Download.