Inverse of a function from $\mathbb{Z}^+ \times \mathbb{Z}^+ \to \mathbb{Z}^+$ Given the function $f: \mathbb{Z}^+ \times \mathbb{Z}^+ \to \mathbb{Z}^+$
$f(a,b) = b^2 +a$, if $b>a$ 
or $a^2 +a + b$, if $b<a$,
which associates $a,b \to z$, find its inverse, which associates $z \to a, b$.

The insignt here is that, if $x < y$ then 
$$(y-1)^2 + (y-1) + x < y^2 < y^2 + x < y^2 + y + x < (y+1)^2$$
Sombeody calculates $f(a,b) = c$, and you are only given c.  You find the bigger of the two numbers by calculating $d = \left\lfloor \sqrt{c}\right\rfloor$.  Then calculate $e = c - d^2$.  If $e < d$, then we are in the $a < b$ case and $(a,b) = (e, d)$.  If $e > d$ then we are in the $b < a$ case, and $(a,b) = (d, e - d)$
