Did I do a horrible job explaining my question or should I just assume it impossible and move on?
Given this square-spiral pattern of numbers:
7 6 5
8 1 4
9 2 3
10 11 12...
Is it possible to create a equation that will give me an X,Y coordinate, with 1 being 0,0, if I have a number (N)?
I figured out an algorithm (of sorts) using the knowledge that evens^2(from 2 up)+1 give a diagonal line upright and odds^2 (from 1 up)+0 give a diagonal line down and that the side length is sqrt(next corner>N [as defined above])-1. This is quite slow and inefficient, hence the hope for some sort of equation or simpler logic to find the coordinates.
Thanks in advanced , and I hope this is the appropriate area to post this question.
Do an internet search for ULAM SPIRAL.
There is a lot of code (in many languages) available that will generate the spiral.
You have the basic understanding of the algorithm and the key, by knowing what numbers will occur at the corners of the squares.
The algorithm you've outlined is not slow nor inefficient.
You know n. The square root (or half the square root shifted) will give the starting coordinates (x,y). Then a subtraction of that will provide the adjustment required for the final coordinate pair.
Write back if you have a problem finding/creating the code.