Exclusion Lines
Where primes aren't

Because I am a software developer (of sorts) I was able to write my own software to generate the Ulam spiral. It was terribly slow to begin with because I didn't know much about generating prime numbers efficiently. I didn't have Internet access at home at that time and was on holiday so I persisted with my very simple software.

I sat watching my software slowly generating the Ulam spiral for the umpteenth time when I noticed two continuous white lines marching North and East in my Ulam spiral. At first I thought they were an artifact of a strange bug in my software, but I had a copy of someone elses Ulam spiral I found on the internet so I checked that one and found the same lines.

The image below is a zoom into a 50 x 50 Ulam spiral with those first lines that I noticed, marked in red.



50 x 50 Ulam spiral with the first lines marked

Below  are the same lines in a 400 x 400 Ulam spiral.


400 x 400 Ulam spiral with the first exclusion lines marked

I decided to call these lines Exclusion lines... because they appeared to exclude integers that I thought might have been prime numbers. Any vertical or horizontal line drawn in the Ulam spiral will run through odd numbers. I suppose I should really have called them composite lines, because they are lines that define numbers that are not prime prime... non primes are called composite numbers.

At this point I decided that instead of looking at where the primes are, I would look at where they are not. These Exclusion lines fascinated me and with my basic knowledge of the Ulam spiral and prime numbers I forged on and decided to look a bit closer.

After some image work, many hours of zooming in and out or the Ulam spiral and drawing lines, I found quite a few more lines.

Diagonal lines that can be considered Exclusion lines are still only one pixel wide, but because the entire Ulam spiral is made up of diagonal lines that are either odd or even it was easier to look for and mark them as two pixel wide lines.... one line crosses a series of odd numbers, the other crosses even numbers.

Below was the result. Please note that this Ulam spiral is an encarnation from my inital software... before I added the ability to define an exact size and the capacity to save the image. I was working with screen shots of the Ulam spiral drawn by my software. Also, please note that the end points of the lines are not pixel perfect... I will get around to making this a pixel perfect rendition, probably when I integrate the underlying math that defines these lines with my software so I don't need to draw them manually!


600 x 600 Ulam spiral with exclusion lines

By keeping the Ulam spiral and the exclusion lines on seperate layers I was able to flick the Exclusion line pattern on and off, which made it easy to see if I had accidentally drawn on top of a prime number (black pixel). Also, once the geometric progression of the lines began to emerge it became easier to find the next line.

Copyright © 2007 - H Rudd