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^+}$?
Integral One-to-one functions in 3 dimensions
3
$\begingroup$
functions
-
0The set of positive integers . Changed it to Z. – 2012-10-10
1 Answers
1
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 $
-
0Note 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. – 2012-10-10