I have a math problem I've been trying to solve for a few months. The problem is that I need a function that will take the input of a coordinate pair (from all quadrants [+x +y , +x -y , -x -y , -x +y]) and output a whole nonnegative number with no repeats. I basically need a function that will give me an ID for EVERY coordinate on an INFINITE grid.
The way I started to attack this problem is to form a pattern in which the coordinates would be numbered. I made it so (0,0) is 1, (0,1) is 2, and (-1, 1) is 3 in a spiral pattern around the origin.
After I labeled a coordinate grid with all the 'IDs' or output numbers I started to try to find patterns in the numbers and try to come up with the functions that would give me the correct ID for each of the coordinate pairs. I have found two functions that will each correctly give me a quarter of the infinite coordinate grids IDs .
If x ≥ |y| ID= [(2x+1)^2] -(x-y)
If -x ≥ |y| ID= [(2x)^2] +(x-y)+1
I've been working on this for months and I really need some help. If anyone is willing to take a look and see if you can find anything I will be so greatful.