Mathematical Foundations of Toothpick Fractal
Introduced by Omar E. Pol and analyzed with David Applegate and OEIS founder N. J. A. Sloane in 2009 (OEIS A139250), the Toothpick Sequence begins with a single vertical toothpick on the plane. At each generation, a perpendicular toothpick is centered on every exposed toothpick endpoint that touches no other toothpick.
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.
Exact OEIS A139250 Recursive Lattice Growth
Generation 1: T(1) = 1 vertical segment [(0,-1) to (0,1)] At generation n: An endpoint P is EXPOSED iff exactly 1 toothpick endpoint lies at P and no midpoint covers P. Place a perpendicular toothpick of length 2 centered at every exposed P. Power-of-2 Closure Law: At n = 2^k, the structure forms a nearly solid square with T(2^k) = (4^(k+1) - 1) / 3 and only the 4 outer corner tips remain exposed (so T(2^k + 1) - T(2^k) = 4)!
Slide the Generation slider to 16, 32, or 64 and watch the "+ new" counter: at Generation 16 (85 toothpicks), Generation 32 (341 toothpicks), and Generation 64 (1,365 toothpicks), the square closes up completely, leaving only 4 exposed corner tips for the next generation!
Iteration Scaling & Complexity Table
| Iteration / Setting | Elements / Size | Geometric Property |
|---|---|---|
| Gen 1 | T(1) = 1 (+1 new) | Single vertical seed toothpick |
| Gen 4 | T(4) = 11 (+4 new) | First 2×2 H-tree square closure |
| Gen 8 | T(8) = 23 (+4 new) | 4×4 recursive corner bottleneck |
| Gen 16 | T(16) = 85 (+4 new) | Exact (4^4 - 1)/3 square closure |
| Gen 32 | T(32) = 341 (+4 new) | Exact (4^5 - 1)/3 square closure |
| Gen 64 | T(64) = 1,365 (+4 new) | Exact (4^6 - 1)/3 full fractal lattice |
Applications in Science, Graphics & Engineering
Experimental Mathematics & OEIS
N. J. A. Sloane ranked the Toothpick Sequence (A139250) among his all-time favorite integer sequences for its self-similar binary Bottleneck pulses.
Binary Hamming Weight Generating Functions
The number of toothpicks added at step n is governed by the binary representation of n via 2-automatic recurrence formulas.
VLSI H-Tree & Metamaterial Routing
Models self-avoiding orthogonal branching waveguides that fill a square domain from a single central feed.
Precision Vector Export
Export any generation from 1 to 64 as a crisp SVG vector diagram with exposed-tip highlights.
Interactive Controls, Pan/Zoom & Vector Export
Step through Generations 1 to 64, observe the gold highlight on newly added toothpicks collapse to just 4 corner picks at powers of two (n = 8, 16, 32, 64), and export vector SVG.
Export crisp 2× Retina PNG renders for presentations or scalable infinite-resolution SVG files directly into Illustrator, Figma, Inkscape, LaTeX, or laser-cutting workflows.