The Sierpiński triangle is a fractal that comes up in unexpected places.
I’m not that interested in fractals, and yet I’ve mentioned the Sierpiński triangle many times on this blog just because I run into it while looking at something else.
The first time I wrote about the Sierpiński triangle was when it came up in the context of a simple random process called the chaos game.
Next I ran into Sierpiński in the context of cellular automata, specifically Rule 90.
A particular initial condition for this rule leads to the image below.
With other initial conditions you don’t get such a clean Sierpiński triangle, but you do get similar variations on the theme.
Next I ran into Sierpiński in the context of low-level programming.
The following lines of C code prints an asterisk when the bit-wise and of two numbers is non-zero.
for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) printf(“%c”, (i&j) ? : *); printf(”
“); } A screenshot of the output shows our familiar triangle.
Then later I wrote a post looking at constructible n-gons, n-sided figures that can be constructed using only a straight edge and a compass.
These only exist for special values of n.
If you write these special values in binary, and replace the 1’s with a black square and the 0’s with a blank, you get yet another Sierpiński triangle.
Finally, if you look at the odd numbers in Pascal’s triangle, they also form a Sierpiński triangle.
.