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: The uncompiled Java program is 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.

Here’s the story at 300,000. Look for the arrow pointing to the termination point.

And finally, below is what the squiggle looks like once the program has counted to a million. Remember the general trend in one direction before 11,000 caused by every fourth interval having a tendency to be larger than the others? Well, just look at the astonishing tendency, within a certain range (I didn’t check exactly what range that is because the processing overhead isn’t worth it, but it’s big) for the squiggle to drift to the right. It’s even more astonishing if you watch the squiggle being drawn in real time, instead of just looking at the final pictures.

We have observed that there are regions of numbers in which every fourth interval between one prime and the next tends to be larger than the other intervals. Several intellectuals (though none of them mathematicians) have confidently told me that there’s nothing significant about this, that it boils down to the same clustering tendency you get when dealing with random numbers. And they add, as though it were some sort of reducto ad absurdum, that if my observation were significant, it would imply that there’s something special about the number four.

Well, I don’t agree with that. I think the results are significant because, as Ian Stewart wrote in The Science of Discworld:

“It’s illegitimate to include the data that brought the clump to our attention as part of the evidence that the same clump is unusual. [...] We can make a simple prediction: ‘From now on, the figures will revert to [appearing random].’ If this prediction fails, and if the results instead confirm the bias that revealed the clump, then the new data can be considered significant.”

Well, those regions where every fourth interval between primes is larger — they pass that test with flying colours. I’m showing the reader the whole thing now, but I’ve watched the squiggle being drawn in real time. And let me tell you, time and time again during those intervals I predicted that the trend would cease soon, and time and again it didn’t. The evidence, I conclude, is overwhelming that this has something to do with a property of prime numbers, and not simply a property of statistics.

As for the argument that my being right would imply that there’s something unique about the number four, who says? To my way of thinking, the counterargument is blindingly obvious. We haven’t tested other numbers, and the result may generalise to them too. In other words, it may be a property of prime numbers that for every suitable number N (including but not restricted to four) there exist intervals on the number line (longer and more frequent ones than you’d expect) in which every Nth interval between adjacent primes tends to be larger than the other intervals. (Not necessarily for every number, you understand, for example perhaps it only works for squares, or of some other set of integers that includes four.)

Any mathematicians out there wish to comment?

[Update October 2008: After I mentioned it in a comment, Matt Springer of Built On Facts dedicated an entire post to this experiment! Read it here.]

About these ads

You are welcome to add your thoughts.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s