3
$\begingroup$

I am looking for a integer-valued one-to-one function that maps coordinates $(x,y,z)$ in space $\mathbb{Z^+}$ to intergers in $\mathbb{Z^+}$?

$\endgroup$
1
  • $\begingroup$ The set of positive integers . Changed it to Z. $\endgroup$
    – adi
    Oct 10, 2012 at 9:56

1 Answer 1

1
$\begingroup$

Let $\{x_i\}_0^\infty$ the decimal representation of $x$, that is $$ x = \sum_0^\infty x_i\cdot 10^i $$ Now to obtain an injective function $f$, you can take as image of $(x, y, z)$ the number whose decimal representation is $$ (x_0, y_0, z_0, x_1, y_1, z_1,x_2, y_2, z_2,\dots) $$ Finally, if you want a function which is also onto, you can use the following one $$ (x, y, z) \to f(x - 1, y - 1, z - 1) + 1 $$

$\endgroup$
3
  • $\begingroup$ I was also wondering , if I have $n$ such tuples ${(x,y,z)}$ , is it possible to come up with a mapping that maps these to ${1..n}$ ? $\endgroup$
    – adi
    Oct 10, 2012 at 10:30
  • $\begingroup$ Of course. You can arbitrarily link each one of those $n$ tuples, $(x, y, z)$, to one number in $\{1,\dots, n\}$, so there are $n!$ different such maps. $\endgroup$
    – AlbertH
    Oct 10, 2012 at 10:41
  • $\begingroup$ Note however, AlbertH's solution provides a unique integer for every unique tuple. To ensure the same for a function mapping to integers in the range of one to n requires knowledge of all tuples that are yet to be mapped. $\endgroup$ Oct 10, 2012 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.