Is there such a function $f(a,b)=k$ where each value of $k$ appears only once for all integer values of $a$ and $b$? Suppose we have $f(a,b)=k$ such that $k$ is an integer when $a$ and $b$ are integers. Is there such a function where each value of $k$ appears only once for all integer values of $a$ and $b$? 
e.g the function $f(a,b)=4ab+3a+2b$ satisfies the qualities for a and b between $0$ and $2$ inclusive.
I can find functions for small ranges of $a$ and $b$, but I have yet to find one that satisfies the property for all integers. Any thoughts?
 A: I can't quite tell whether you're asking for an injection or a bijection $f:\mathbb{Z}\times\mathbb{Z}\to\mathbb{Z}$. (An injection guarantees that each $k$ is output only once, if it is output at all; but it may not be output unless we in fact have a bijection.) 
There are infinitely many such functions, but here's a fun and rather natural injection. It has a "computational" flavor: unlike mysterious rabbit-out-of-the-hat Cantor factorizations, it is the sort of thing a programmer or cryptographer might think of.

To get an injection, we need to be able to recover the inputs based only on the output. So why not directly encode the inputs into the output? Given integers $a$ and $b$, take their binary numerals; interpret them as ternary numerals instead; then concatenate them with an intervening digit of $\mathtt{2}$. Then let $f(a,b)$ be the integer corresponding to that concatenated numeral. What about negatives? If $a$ is negative, tack on a $\mathtt{2}$ at the left of its binary numeral before concatenating; if $b$ is negative, tack on a $\mathtt{2}$ to the right of its binary numeral before concatenating. This way the ternary numeral of the output will always have at most three $\mathtt{2}$'s: one in the middle to separate the binary numerals of the inputs, and possibly two more at the edges, depending on whether the inputs are negative.
For example, $f(8,11)=6754$ because $8$ is $\mathtt{1000}$ in binary, and $11$ is $\mathtt{1011}$ in binary, so their concatenation according to the above scheme is $\mathtt{100021011}$, which represents the integer $6754$ in ternary. Similarly, $f(-1,3)=211$ because $1$ is $\mathtt{1}$ in binary, and we append a $\mathtt{2}$ at the front to get $\mathtt{21}$ before concatenating; $3$ is $\mathtt{11}$ in binary; so their concatenation is $\mathtt{21211}$, which represents the integer $211$.
A: There's a standard bijection, the Cantor pairing function, which takes $(a, b) \mapsto \frac{1}{2} (a+b)(a+b+1) + b$. This is a bijection $\mathbb{N}  \times \mathbb{N} \to \mathbb{N}$.
To create a bijection $\mathbb{Z} \times \mathbb{Z} \to \mathbb{Z}$, just take your favourite bijection $\mathbb{Z} \to \mathbb{N}$ (e.g. if $n$ is nonpositive, send it to $-2n$, otherwise to $2n-1$), and compose with that.
