Bitwise Fractals

Binary AND

Simply compute z = x & y for every point on a graph, and you get this fractal. In a bitwise AND operation, each bit is ANDed with the same bit in the other number. For example:

x=6=110
y=5=101
x & y=4=100

The fractal is Pascal's Triangle (aka the Sierpinski triangle).


↗ https://icefractal.com/fractalator/#0,0,0.8,1,(xH28)%26(yH28),i,i,i

Here it is as a 3D surface: z = f(x, y)

In fact, almost all bitwise operations produce fractals! However, only AND will return to zero frequently, thus showing a clear pattern on a 2D image. To see the other bitwise fractals, they must be graphed in 3D.

Binary OR

Binary XOR

A true aficionado will point out that these are not proper fractals, because there is a minimum scale set by the integers used. If you zoom in far enough, there are discrete steps, and the fractal pattern stops.

However, binary numbers are not limited to integers. All real numbers can be expressed in binary. For example, what's 3.25 in binary? It's 11.01. You can perform a bitwise AND on any pair of real numbers, including infinitely many fractional bits, thus creating a true fractal that has infinite complexity whether you zoom in or out!

This is difficult to draw in 3D, but here is a 2D slice taken from the fractal z = x & y along the line y = x*2

Binary AND

Zoom in or out on the above graph, and you'll see the same pattern everywhere, at any scale!

(Until you go so far that the web browser's number precision is not good enough.)