Circles and Squares

Lay a grid of dots over the plane, with a fixed step between neighbors. For each dot, compute x2+y2x^2 + y^2 and drop the fraction, then paint the dot light if the whole number is even and dark if it is odd. John Connett found this picture by accident, while working on a program to draw the Mandelbrot set.1

Points at the same distance from the center get the same value, so the rule draws one set of rings around one center, and when the dots are close together that is what you see. Spread the dots apart by raising the step between them.

Check the same rings at fewer places

Right: 90 by 90 dots. Left: a close-up of the marked part, with the true rings behind its dots.

A ghost center every 11.9 dots

More centers appear, in rows, each with its own rings, even though the formula has only one center. All the others are ghosts.

Rings get thinner as they go outward, and eventually they are thinner than the gaps between dots, so a row of dots skips over whole rings. At certain distances it skips exactly one ring per dot, or two, or any whole number, which puts each dot at the same place in its ring as its neighbor. That row looks as if it has stopped moving outward at all, and to the eye that is a center.

You can check this with the numbers. "Even or odd" is the same as keeping the remainder after dividing by m=2m = 2. With a step of ss, moving nn dots along a row adds 2nsx2nsx to x2+y2x^2 + y^2, plus a constant. Dots sit at multiples of ss, so when n=m/(2s2)n = m/(2s^2) is a whole number, this added amount is a whole multiple of mm, and the remainder ignores it. The rings around that dot are then an exact copy of the rings around the true center, except that light and dark swap when nn is odd. Most steps don't make nn a whole number, so the nearest dot gives a close copy instead.2

The close-up at a ghost center shows this directly: there is one full ring between neighboring dots, so every dot in that row lands at the same place in its ring.

The result is a moiré pattern, like the shimmer of two overlapping window screens, and it belongs to the dots rather than to the rings. MathWorld lists it among fractals, but it does not contain smaller and smaller copies of itself, because if you zoom in far enough you only see the rings.1

MathWorld writes the rule as zn+1=zn2(modm)z_{n+1} = z_n^2 \pmod m.3 This page reads that as z1=x2+y2z_1 = x^2 + y^2, with m=2m = 2 by default. Squarings in the controls repeats the square-and-remainder step, which folds each ring into many.

Further exploring

Sources and notes

  1. Aliasing Artifacts and Accidental Algorithmic Art, §3, on A. K. Dewdney's 1986 column about Connett's program. It also notes that the pattern is not technically a fractal.
  2. Calculation. With k=s2/mk = s^2/m, a dot at grid position (i,j)(i, j) has value k(i2+j2)k(i^2 + j^2). Moving by nn dots gives k(i+n)2=ki2+2kni+kn2k(i+n)^2 = ki^2 + 2kni + kn^2. The article's nn makes 2kn=12kn = 1, so 2kni2kni is a whole number and only the constant kn2=n/2kn^2 = n/2 remains. That is half a cycle when nn is odd, which swaps light and dark.
  3. Circles-and-Squares Fractal.