This fractal looks relatively simple, but how would you generate it?

Triangular fractal

On a smaller scale:

Zoomed in triangular fractal

I made it using a 1D cellular automaton with a four cell neighborhood:

diagram showing the cells that contribute to each generation of the automatin - 3 from previous generation and 1 from the one before that

 ..|-|..    2 generations back
|-||-||-|   1 generation back
 ..|-|..    current generation

But since there are $65536$ possible rules for this CA, and I don't remember this particular one, it's unlikely I will find it again.

For the Sierpiski triangle we have many different ways to generate it (see this page for example).

I would really like it if the answer contained a generated fractal. I would also love to know another method of generating it, not related to cellular automata.

  • $\begingroup$ What exactly are you asking? There are three different questions here. $\endgroup$
    – Deusovi
    Sep 27, 2016 at 21:08
  • 1
    $\begingroup$ @celtschk, see the new image for clarification $\endgroup$
    – Yuriy S
    Sep 27, 2016 at 21:25
  • 1
    $\begingroup$ I found this rule given as an example in Mathematica's documentation! (look under Scope > Higher-Order Rules) They call it "Rule 150R—the second-order reversible mod 2 rule" $\endgroup$ Sep 27, 2016 at 22:15
  • 2
    $\begingroup$ @TheGreatDuck: Start by coloring in one pixel. Then move down one row, and color in every pixel that has an odd number of pixels in the four closest squares above it. Repeat over and over. $\endgroup$
    – Deusovi
    Sep 27, 2016 at 22:45
  • 1
    $\begingroup$ @elias, maybe you could read the first paragrath of mathworld.wolfram.com/ElementaryCellularAutomaton.html, it explains why there are 256 rules for elementary CA with 3 parent cells. The same logic applies here $\endgroup$
    – Yuriy S
    Sep 28, 2016 at 7:22

5 Answers 5


The pattern is self-similar, and can be formed by repeatedly scaling and rotating copies of itself:

enter image description here

An alternate dissection that fits in a diamond:

enter image description here

  • $\begingroup$ What is the minimal starting element? $\endgroup$
    – Yuriy S
    Sep 27, 2016 at 22:40
  • 1
    $\begingroup$ @YuriyS Any shape you want; since it is eventually shrunken to a point it doesn't matter. I used a triangle covering the upper half. $\endgroup$ Sep 27, 2016 at 22:41
  • $\begingroup$ The second case is more clear to me. Thank you! $\endgroup$
    – Yuriy S
    Sep 27, 2016 at 23:31
  • 4
    $\begingroup$ Is there a nice way to derive this self-similarity relation from the rule? $\endgroup$
    – xnor
    Sep 28, 2016 at 5:17
  • $\begingroup$ @xnor Not that I know of, I just figured it out by observation. $\endgroup$ Sep 28, 2016 at 20:36

There are only 16 different possible state combinations of the four ancestor cells, and you can find them all in the image, so there is a unique answer.

The rule is as follows:

The new cell lives if there is an odd number of live ancestor cells.

  • $\begingroup$ I must admit, this is a pretty neat way to find the rule, using a random 'snapshot' of a CA pattern $\endgroup$
    – Yuriy S
    Sep 27, 2016 at 21:56

I think the rule is:

A cell is black if and only if an odd number of the four "parent" cells is black.


This is by no means an answer, but using @2012rcampion's interpretation, I wanted to illustrate how this fractal can be generated using top-down approach, starting from a single element:

   /\  /\
  /  \/  \
 /   /\   \
/   /  \   \
\  /    \  /
 \/      \/
 /\      /\
/  \/\/\/  \
\  /\/\/\  /
 \/      \/

enter image description here

Step one:

enter image description here

Step two:

enter image description here

Step three:

enter image description here

The element is scaled down by a factor of $2$ on each step and added to any place we can. I omitted some of the elements, which didn't fit on the picture.


Simply because I posted some code for a similar puzzle a few minutes ago, I may as well post some Excel VBA code to generate this one too:

Sub RunIt()
    Application.ScreenUpdating = False
    Dim r As Long
    Dim c As Long
    Dim cnt As Integer
    Cells.Interior.Color = xlAutomatic
    Cells(2, 8000).Interior.Color = vbRed
    r = 3
    Do While r < 500
        For c = 8000 - r To 8000 + r
            cnt = 0
            If Cells(r - 2, c + 0).Interior.Color = vbRed Then cnt = cnt + 1
            If Cells(r - 1, c - 1).Interior.Color = vbRed Then cnt = cnt + 1
            If Cells(r - 1, c + 0).Interior.Color = vbRed Then cnt = cnt + 1
            If Cells(r - 1, c + 1).Interior.Color = vbRed Then cnt = cnt + 1
            If cnt = 1 Or cnt = 3 Then
                Cells(r, c).Interior.Color = vbRed
            End If
        r = r + 1
    Cells(1, 8000).Select
    Application.ScreenUpdating = True
End Sub


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.