Haifeng Ge

Sierpiński Triangle

Before the in-depth study of fractal geometry, artists in 16th-century such as lace-makers and stone-carvers created repeating self-similar patterns and created artwork with it. A notable example is the Sierpinski’s Triangle:

source

Sierpinski triangle pattern in 11th centry Sierpinski triangle pattern in 13th centry

Interestingly, the Sierpinski’s triangle also appears naturally: Sierpinski triangle pattern in seashell

In 1915, the Polish mathematician Sierpiński gave this shape its official math name, building on ideas from Georg Cantor’s work on “strange” sets that are everywhere yet take up zero space. Nowadays folks discovered a playful way to “draw” it by randomly hopping halfway to triangle corners.

You can also play the “Chaos Game”:

Play it in my google colab page.

-n=100 simulate Sierpinski Triangle n=100

-n=1000 simulate Sierpinski Triangle n=1000

-n=10000 simulate Sierpinski Triangle n=10000

Another way to create the Sierpinski’s triangle is to start with a non-filled equilateral triangle. Then, draw a filled equilateral triangle where each vertex is located at the midpoint of the non-filled triangle. Create filled triangles in this fashion by using the midpoints of the non-filled equilateral triangles. This process will create Sierpinski’s triangle.

The self-similarity of the triangle is also intruiging:

Leave your comments below!

Python Code

# Demo of piraling Through the Collatz Conjecture
# Description: Plot each term of a Collatz sequence in polar coordinates, and show the result
# of a swirling spiral
# Author: Daniel Ge
# Date:   2025-04-26

import random
import matplotlib.pyplot as plt

def sierpinski_triangle(n):

  A = (0,0); B = (1,0); C = (0.5, 0.866)
  x, y = 0.3, 0.4  # starting point
  points = []
    
  for _ in range(n):
      vertex = random.choice([A, B, C])
      x = (x + vertex[0]) / 2
      y = (y + vertex[1]) / 2
      points.append((x,y))

  xs, ys = zip(*points)
  plt.scatter(xs, ys, s=0.1)
  plt.axis('off')
  plt.show()

n = 100
#n = 1000
#n = 10000
sierpinski_triangle(n)