Prime squiggle
I have a computer program I once wrote which counts 2, 3, 4, 5, … all the way up to a specified termination point, and draws a squiggly line according to a simple mathematical rule.
Every time the counter passes a prime number, the line turns a 90 degree corner. Every time it passes a composite number, the line is extended one pixel forward. It goes up on four (the first composite), left on six (having passed the prime five), down on eight, nine and ten (having passed the prime seven), right on twelve, and so on.
[Update June 2007: I have made the Java program available for download here. The "PrimeFinderMessGUI" Java application will display instructions on standard output.]
Here is a picture of what the line looks like after the program has counted to 100,000. Notice that up until about 11,000 (and there are over a thousand primes before 11,003) the overall trend is very distinctly vertical, rather like rising smoke. This means that every fourth interval between primes in that range tends to be larger than the rest, which is surprising. But wait! You ain’t seen nothing yet.
