Draw a Cantor Fractal screenshot

Draw a Cantor Fractal

Count the segments and surviving length of a Cantor comb after n steps, with the removed share as a percentage.

Privacy First
0 Runs
Updated 2026-11-06
No upload

Count the dust instead of drawing it

The Cantor comb keeps the two end thirds of every segment and removes the middle third. Starting from one segment of length L, step n holds 2^n segments and their total length is L multiplied by (2/3)^n. The page prints the segment count, the total length and the percentage of the starting length that has been removed.

The pair of figures is the interesting part: the count doubles forever while the length falls to zero. A set with uncountably many points and measure zero is why this construction is called dust rather than a line. Both figures are closed-form, so the page multiplies rather than recursing.

Steps are capped at 12, where the count is 4,096 and the length is already about 0.8 percent of the start. The starting length must be above zero and the step count a whole number; anything else is refused with the reason rather than silently clamped.

The Cantor comb keeps the two end thirds of every segment, so step n holds 2^n segments and their total length is the starting length times (2/3)^n. The page prints the count, the surviving length and the removed share, and stops at 12 steps, where the count has already reached 4,096.

How to use it

Enter a starting length and the number of steps, then press Run. The first line is the segment count, the second the total length still covered, and the third the percentage of the start that the middle-third removal has taken away. Both numbers are used exactly as typed.

The arithmetic

Each step keeps the two end thirds of every segment, so the count is 2 raised to the step count and the surviving length is the start multiplied by two thirds raised to the same count. The page evaluates those two closed forms directly; there is no loop over individual segments, which is why even the largest step count returns instantly.

Where it stops

The count doubles without limit while the length falls toward zero — a set with uncountably many points and no length at all. That is why the construction is called dust. Zero is refused rather than quietly treated as a degenerate case, and a non-whole step count is refused because there is no half step in the construction.

What to Expect

Best for

  • students meeting a measure-zero set
  • checking a Cantor comb by hand

What this tool keeps

  • the segment count, the surviving length and the removed percentage

Sample input

Starting length 100, 4 steps

Sample output

Segments = 16 Total length = 19.7531 (from 100) Removed = 80.2469% of the starting length

Frequently asked questions

How do I use the Cantor dust counter?

Type a starting length and a whole number of steps, then press Run. The page prints the segment count, the total surviving length and the removed share as a percentage, and reloading clears both fields.

Is anything uploaded?

No. The two multiplications happen in this tab with JavaScript: no request is made, no account is needed, nothing is stored, and the page keeps working offline once loaded.

What are its limits?

The length must be above zero and the step count must be a whole number from 0 to 12. Twelve steps already gives 4,096 segments and under one percent of the starting length, so a larger count would print digits with no meaning behind them.

Developer program

Build custom tools for your store

Join the SDK program to create useful ecommerce utilities for your store.