Ulam spiral coordinate system - MathOverflow most recent 30 from http://mathoverflow.net 2013-05-26T08:42:10Z http://mathoverflow.net/feeds/question/29038 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://mathoverflow.net/questions/29038/ulam-spiral-coordinate-system Ulam spiral coordinate system cerebral_monkey 2010-06-22T03:47:35Z 2010-06-22T09:28:38Z <p>Inspired by a <a href="http://projecteuler.net/index.php?section=problems&amp;id=28" rel="nofollow">Project Euler problem</a>, I recently started playing around with <a href="http://mathworld.wolfram.com/PrimeSpiral.html" rel="nofollow">Ulam spirals</a>. My first thought was that an Ulam spiral could be a (rather useless) coordinate system, and how I might be able to convert from "Ulam coordinates" (i.e. just the number on the spiral at a given point) to rectangular coordinates and vice versa.</p> <p>So the question is: Is there a single function that would return the number on the Ulam spiral given (x,y)? And also (and perhaps more of a challenge), one to convert back? </p> <p>I'm just a sophomore computer science student, and not terribly competent in math compared to the people on these site, sadly (I'm in Calc III right now). I was able to work out four separate equations to find the number on the spiral given an ordered pair, but that's one for each of four sections in between the 'diagonal axes' (I'm not sure what to call them). Unfortunately, I have yet to make this more simple. Any ideas?</p>