Describing a Line

From those first hand drawn one I wanted to find a way to mathematically describe those lines. Having just drawn the spirals I was looking at the relationship between the first number on the line and the next as how far around the spiral I needed to go.

Ulam Spiral Formula

What I came up with was:

So that

p The starting number of the line I wished to describe.
x The count of how far out from the center the p is.
c A constant that is dependent on the direction the line is travelling in.

The values for the constant c are below based on the compass points

East c=1
NE c=2
North c=3
NW c=4
West c=5
SW c=6
South c=7
SE c=8

So as an example if I want to describe the line starting a 3 (p=3 x=1) and going in the NE direction (c=2)

Ulam Sprial NE 3 Line

So 13 is my new p and x is now 2 so the next point is

Now 31 is my new p and x is 3

We can continue that for as long as we want. We can also start at a point farther out. We either need to count how far out it is or use a previously calculated line. So if I wanted to start a new line at 31 I already know that x=3. So if I want to go off in the NW direction the c=4 so:

Ulam Sprial NW 31 Line

Leave a Reply