Bitwise Fractals
Binary AND
Simply compute z = x & y for every point on a graph, and you get this fractal. A binary AND is 1 if both bits are 1, and otherwise is 0. In a bitwise '&' AND operation, the numbers are represented in binary and each bit in a column is ANDed with the same column in the other number. For example:
| x | = | 6 | = | 0110 |
| y | = | 5 | = | 0101 |
| x & y | = | 4 | = | 0100 |
The AND operation is 1 in a column if both bits are 1, and otherwise is 0. The x and y coordinates are just the Cartesian axes, but expressed in binary. The fractal produced is Pascal's Triangle (aka the Sierpiński triangle).

↗ Open in the Fractal Texture Generator
Here it is in 3D as a surface: z = f(x, y)
In fact, almost all bitwise operations produce fractals! However, only AND will return to zero frequently enough to show a clear pattern on a 2D image. To appreciate the structure of 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 easier to visualize as a 1D function.
1-Dimensional Binary AND Slice
Here is a slice taken from the fractal z = x & y along the line y = 2x
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.)
Fractal Music
You can make beautiful music with binary 1-dimensional fractals by using the function value as a note index, modulo a fixed range. A single equation writes an endless concert!
(x & (2 * x)) % 7
The x value is time, and it plays the function value at each sample as a white note index starting at A, 440 Hz. You can combine these equations with familiar math functions, such as sine and cosine, to introduce periodic musical patterns into the fractal.
Here is a tool to generate music from any mathematical function, f(x):
