Among all 256 elementary cellular automata rules, Rule 90 holds a celebrated place in geometry and number theory.
In binary notation:
$$90 = 01011010_2$$
Look closely at the transition table for Rule 90:
$$\begin{array}{|c|c|c|c|c|c|c|c|c|}
\hline
\text{Pattern } (L, C, R) & 111 & 110 & 101 & 100 & 011 & 010 & 001 & 000 \\
\hline
\text{Output} & 0 & 1 & 0 & 1 & 1 & 0 & 1 & 0 \\
\hline
\end{array}$$
Notice that the output does not depend on the center cell $C$ at all! The new cell is $1$ if either the left cell is $1$ OR the right cell is $1$, but NOT both.
Mathematically, this is the Exclusive OR (XOR) operation, which is identical to addition modulo 2:
$$C_{\text{new}} = (L + R) \pmod 2 = L \oplus R$$
The Connection to Pascal's Triangle
In Pascal's Triangle, every number is the sum of the two numbers above it:
$$\binom{n}{k} = \binom{n-1}{k-1} + \binom{n-1}{k}$$
If you color all the odd numbers black ($1$) and all the even numbers white ($0$) — which is taking Pascal's triangle modulo 2 — you get the exact mathematical formula of Rule 90!
Starting from a single seed, Rule 90 generates the famous Sierpinski Triangle fractal:
A self-similar geometric fractal with holes at every scale.
Its perimeter is infinitely long, but its area is zero!
Its fractional Hausdorff dimension is $D = \frac{\log 3}{\log 2} \approx 1.585$.
ca_wolfram(90) ca_run(39, 45)
Move the mouse over a dotted box for more information.
Fractal Self-Similarity: The large triangle is composed of 3 smaller copies of itself, each of which is composed of 3 even smaller copies, repeating infinitely!
Linearity: Because Rule 90 uses modular addition ($L \oplus R$), it satisfies the principle of superposition: the pattern formed by multiple starting seeds is simply the XOR sum of the individual triangles!
Now you try. Run the code and count the powers-of-two sizes of the inverted black triangles.
Type your code here:
See your results here:
The code has ???? for rule. Replace ???? with 90 and click Run to watch the Sierpinski Triangle fractal emerge!
1. Observe the nested triangular voids (holes) of sizes 1, 2, 4, 8, 16... powers of 2!
2. Notice how perfectly symmetric the fractal is on both sides of the center axis.
Share your code
Show a friend, family member, or teacher what you've done!