A while ago, Dan Pearcy approached me with a similar problem, asking for the inverse formula to convert $n$ into coordinates $(x,y)$. Using the floor function, it was not too difficult to provide an explicit closed form. He wrote a blog post about this, including my extremely messy closed form: http://danpearcymaths.wordpress.com/2012/09/30/infinity-programming-in-geogebra-and-failing-miserably/