Mathematisches

Fractals from bits. Feed a number sequence, watch geometry emerge.

sequence limit =
try →
speed color

Non-negative integers

The classic Thue-Morse walk. Every integer from 0 to your limit is checked for binary parity. At 65,536 steps this traces the complete Koch snowflake — a fractal with infinite perimeter but finite area, emergent from nothing but bit counting.

select a sequence and press Draw
scroll to learn more
how it works
step 01

Pick a number

Every integer has a binary representation — a string of 1s and 0s. Count how many 1-bits it contains.

n = 13 binary 1 1 0 1 three 1s → odd
step 02

Check the parity

Even count of 1s → command F (forward). Odd count → command T (turn left 60°).

even 1-bits F step forward odd 1-bits T turn left 60° 0→F 1→T 2→T 3→F 4→T 5→F 6→F 7→T
step 03

Walk the turtle

A virtual turtle reads each command. F means walk one step. T means pivot 60° left. Every number leaves a mark.

← turtle F T F T F T
step 04

Fractal emerges

At 65,536 steps, the complete Koch snowflake appears — infinite complexity from a single arithmetic rule.

Koch snowflake — 65,536 commands
sequences
Non-negative integers
The classic. Produces the Koch snowflake at 65,536.
Prime numbers
Chaotic, angular. No pattern ever repeats.
Fibonacci
Sparse growth creates nested hexagonal loops.
Even numbers
A sparser Koch — same fractal, wider steps.
Odd numbers
The Koch curve's mirror image — same geometry, flipped.
Binary palindromes
Long sweeping lines with small geometric knots.
context
Helge von Koch — Swedish mathematician, 1870–1924

Helge von Koch

In 1904, Swedish mathematician Helge von Koch introduced what we now call the Koch curve — one of the earliest known fractals. His goal was purely theoretical: construct a curve that is continuous everywhere but differentiable nowhere. A line so jagged that no matter how far you zoom in, it never becomes smooth. He had no idea this shape would later appear in coastlines, snowflakes, lightning bolts, and blood vessels. Koch was making a mathematical counter-example. He accidentally described nature.

the sequence

The Thue-Morse Sequence

Take any non-negative integer. Count the number of 1-bits in its binary representation. If that count is even, write 0. If odd, write 1. Do this for every integer from 0 onwards and you get: 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1... — the Thue-Morse sequence, independently discovered by Axel Thue in 1906 and Marston Morse in 1921. Now interpret 0 as "step forward" and 1 as "turn left 60°" — and watch the Koch snowflake fractal draw itself, emergent and complete, from nothing but the parity of binary digits.

Axel Thue — Norwegian mathematician, 1863–1922