Presets
Playback
View
Shape
Run
Pascal's triangle
Zoom (wheel or slider, drag to pan)
Layers
Model check
The science
Three ways to the same set
Chaos game. Start anywhere, pick one of the n polygon vertices at random and jump the fraction 1 - r of the way towards it: x ← r x + (1 - r) vi. For a triangle and r = 1/2 the orbit fills the Sierpinski triangle. Exact recursion. The same n maps applied to a filled polygon k times give nk copies of size rk. Pascal. Colour the entries of Pascal's triangle that are not divisible by p; for p = 2 this is the Sierpinski triangle again.
Dimension
The set is made of n copies scaled by r, so its similarity dimension is D = ln n / ln(1/r): ln 3/ln 2 ≈ 1.585 for the triangle. It has zero area (the area left after k steps is (n r2)k = (3/4)k for the triangle) but infinitely long boundary. The page also measures D by box counting: the number of occupied boxes of side ε grows like ε-D, so the slope of ln N against ln(1/ε) estimates it.
Touching ratio
The copies exactly touch when r = 1 / (2 (1 + Σk=1..⌊n/4⌋ cos(2πk/n))): 1/2 for the triangle and the square, 0.382 for the pentagon (the pentaflake), 1/3 for the hexagon. Larger r makes the copies overlap and the formula gives D > 2, which is not a real dimension; smaller r leaves gaps. Banning the same vertex twice in a row turns the square case into a carpet-like fractal.
Pascal's triangle modulo p
The count of entries not divisible by p in the first pk rows is (p(p+1)/2)k (Lucas' theorem), hence the dimension ln(p(p+1)/2)/ln p: 1.585 for p = 2 and 1.771 for p = 3.
Honest simplifications
The box-count slope is measured on a 512 x 512 grid from a finite orbit, so it is only reliable between box sizes of about 4 and 64 cells and underestimates the dimension for sparse orbits. The first 20 points are discarded as transient. For ratios where copies overlap, the box-count dimension saturates near 2. Educational model.
Model checks in this page
(1) the box-counting dimension of a 600 000-point chaos game matches ln 3/ln 2; (2) the numbers of odd entries in the first 2k rows equal 3k; (3) the summed area of the depth-6 triangles equals (3/4)6.