There are 4 attached pictures of Ulam spirals.
- A very zoomed out white version of the Ulam spiral
- The same Ulam spiral but colored based on the x coordinates.
- The same colored version, but zoomed in with some numbers and the 0,0 origin coordinate labeled.
- An Ulam spiral for clarity from a 3rd party website.
Link to what an Ulam Spiral is: https://en.wikipedia.org/wiki/Ulam_spiral Note: The picture of this Ulam spirals attached to this post are base zero, unlike the base 1 example from wikipedia.
In the second picture, (the zoomed out colored one), if you look closely you will see a pattern of colors distributed unevenly in different parts of the spiral. This color pattern changes along the diagonals from the middle of the spiral. I'm trying to figure out if anyone has a way to explain why this happens, as I would assume there should be a random distribution throughout the whole column for a given x value.
Please note, when I refer to "x", I'm referring to the x coordinate in the Cartesian plane.
So, for (x, y) coordinates:
- blue pixels are primes who's ulam values reside on the vertical lines of x such as:
- ..,-6, -3, 0, 3, 6,..
- red pixels are primes who's ulam values reside on the vertical lines of x such as:
- ..,-5, -2, 1, 4, 7,..
- green pixels are primes who's ulam values reside on the vertical lines of x such as:
- ..,-4, -1, 2, 5, 8,..
Explained in another way, all primes that have a x coordinate of -6 are blue. All the ones with -5 are red. All the ones with -4 are green are so on, and this repeats for the entire Cartesian plane.
Blue, Red, Green is used to determine the colors of the primes based on the column they reside. Essentially I'm using a modulus 3 for column number to assign colors.
Why do we see randomness in left and right quadrants but mainly green and red in the top quadrant and blue and red mainly in the bottom quadrant. Note: I'm using the term "quadrant" here in a non traditional sense where the quadrant are based on the diagonals from the origin, not the x/y axis.
Interesting Note: Using the same method but flipped for Y, (if you do the coloring based on horizontal lines with given Y coordinates instead of X), you will instead see a seemingly random distribution in the top and bottom and then specific densities of prime in the left and right.
Can someone explain this or if it has already been written about somewhere?
Additional pictures for clarity: (June 20th edit)
In the zoomed up examples for red pixels along x=1 and x=-2
- x=1 red pixels ulam values: (59,13,2,23)
- x=-2 red pixels ulam values: (97,17,19,43,113)
x,y (0,0) marked for clarity.
This is just an example where every ulam value is explicit (grabbed from here: http://primorial-sieve.com).




This is a normal ulam spiral where the black pixels are non prime numbers and the red/green/blue pixels are primes. I'm coloring the pixels different colors based on the which column in the cartesian plane the prime resides. Would you be able to help me formulate my question more clearly?
– Michael Tidwell Jun 13 '22 at 19:12