Ulam Spiral, what angle does x fall on?

93 Views Asked by At

Morning all,

I'm trying to work out what angle a given number will fall on within the Ulam Spiral.

The formula I have so far is this: $$ \dfrac{180 \times\sqrt{x}-255}{360} $$

For example using $x= 49$ we have $\sqrt{49}= 7$, $7 \times 180 = 1260$; $1260 - 225 = 1035$; $1035 / 360 = 2.875$

This tells me that $49$ is $2.875$ rotations from the centre. To find the angle, I take the decimal $0.875$ and multiply by $360$, giving me $315$ degrees. This works for any number that falls on the $315$ degree, e.g. $9, 25, 49, 81$ etc.

The problem is, this doesn't work for any number that doesn't sit on the $315$ angle. I have feeling that this is to do with using $225$, but I don't know where this number comes from or what formula I should use to work this out.

You may have guessed that I'm not a mathematician, so please be gentle!

Many thanks

Pete