Layered Ulams
Another dimension

Since the vertical and horizontal Exclusion lines in the first three iterations of the Ulam spiral appeared to be the same distance apart I thought it would be interesting to update my software to allow layering of Ulam iterations... I wanted to see if the vertical and horizontal exclusion lines stayed in the same place no matter how many iterations the Ulam spiral went through.

Below are the first 9 iterations of the Ulam spiral. These are all 200 x 200 pixel wide for the sake of keeping page size reasonable. 
  

Iteration 1 (standard Ulam)
 

Iteration 2
 

Iteration 3
 

Iteration 4
 

Iteration 5
 

Iteration 6
 

 Iteration 7
 

 Iteration 8
 

 Iteration 9
 

When I first tried to layer the Ulam iterations with my software it didn't work. I then remembered that when I manually confirmed that the lines were the same distance apart using image editing software, I had to move the centre of the Ulam spiral... moving the centre to the right by one pixel for each iteration.

So I updated my software to start rendering the Ulam spiral at an offset from the center... moving to the right, along the X Axis. The offset was the same value as the Ulam iteration... so, for example, the 25th Ulam spiral was 25 pixels to the right of the centre.

This didn't quite work either, vertical lines persisted for a few iterations but washed out quickly after that, after a little more thought it made sense to increment the Y Axis as well... when I was manually checking I was looking at the top of the exclusion lines.

So I updated my software to offset the X and Y axis for each iteration of the Ulam spiral... and that worked. The vertical lines persisted no matter how many Iterations I let my software run through. Of course this is not a proof in any mathematical sense... I would need to run my software indefinitely to prove that the exclusion lines persisted forever.

Below is an image after layering 500 Ulam iterations.

 
500 Ulam iterations layered


The black spiraling line heading South East is the number 2. It is the only even prime and sticks out like a sore thumb because it joins the pixels around it to make that area seem blacker... all the pixels are black but when you have white space between black dots they seem grey. This effect is exploited when creating black and white newspaper images... all the ink is black but the ratio between black and white and the spacing between the black dots creates the illusion of various shades of grey.

The only Exclusion lines that persist are those in the opposite quadrant to the direction that the Ulam spiral is offset. If the offset is directed in any of the other three directions (North East, South West and North West) then the Exclusion lines in the opposite quadrant appear.

Lets zoom into the quadrant so we can see the exclusion lines a little better... the red arrows point out the Exclusion lines.

 

 

Another way of bringing out the vertical lines is to grab the scroll bar on your web browser and move it up and down whilst looking at the image...this works especially well on the large image. I used this technique to help me locate Exclusion lines while doing manual image work.

As the Ulam iterations increase, the number of primes that land somewhere on the image being rendered decreases. This is because the size of the Ulam spiral being draw is getting larger and larger, the black spiraling line that the number 2 marks out shows the center of the Ulam spiral heading off the drawing area... the further it goes the less that the Ulam sprial being generated actually contributes to the image being rendered. The number of primes found in each iteration when processing in this way is the same, but more and more of them are 'off screen'. They trickle in... occasionally landing on the drawing area and after, I suspect, an inifite number of iterations the image would be completely black with white lines... the Exclusion lines would be the only feature.

If you head North or East or South or West (either incremementing / decrementing only the X or Y axis) then the diagonal exclusion lines persist... I am looking only at the vertical ones in detail here.

 

Copyright © 2007 - H Rudd