The Prime Spiral:

Completed in seconds.

The concept of the prime spiral is simple: start at the center of a square and spiral outwards, inverting bits whose positions correspond to prime numbers. (Click here for a close up detail drawing that might explain this a little better.) Since there's no formula to produce primes, they're found by algorithm, you might expect the pattern to be random (~ 10% gray shade, roughly the frequency of primes). What you get instead are numerous broken diagonal lines, voids and other patterns. Let your imagination and intuition figure out why. (You can either start with zero as your center, like this implementation, or one, it doesn't affect the pattern much nor does the direction you spiral.)

The prime spiral tests how efficiently your workstation (and programmer) can compute primes and plot single bit data points. (Click here for the history of this program.) I also have a much faster (and larger) Java implementation of this program available, with source.

Christopher Lane

Orignial version located here; this version with adapted script for modern browsers by jln2nd