# Sierpiński arrowhead curve

See Wikipedia.

Sierpiński curves are a recursively defined sequence of continuous closed plane fractal curves discovered by Wacław Sierpiński, which in the limit $n\to \mathrm{\infty}$ completely fill the unit square: thus their limit curve, also called the Sierpiński curve, is an example of a space-filling curve. Because the Sierpiński curve is space-filling, its Hausdorff dimension (in the limit $n\to \mathrm{\infty}$ is $2$

The Euclidean length of the $n$th iteration curve ${S}_{n}$ is

${l}_{n}=\frac{2}{3}(1+\sqrt{2}){2}^{\mathrm{n}}-\frac{1}{3}(2-\sqrt{2})\frac{1}{{2}^{n}}$

i.e., it grows exponentially with $n$ beyond any limit, whereas the limit for $n\to \mathrm{\infty}$ of the area enclosed by ${S}_{n}$ is $\frac{5}{12}$ that of the square (in Euclidean metric).

This is the second line fractal I created using the production rules. I created a function that can be passed a formula to execute. See Rewriting and L-system.

The production rules for this curve is:

Alphabet: F, G, X Constants: F, G, +, − Axiom: F−−XF−−F−−XF Production rules: X → XF+G+XF−−F−−XF+G+X Angle: 45

Here, both F and G mean "draw forward", + means "turn left 45°", and − means "turn right 45°" (see turtle graphics). The curve is usually drawn with different lengths for F and G.