For what regards my encoding, it is based on the fundamental theorem of arithmetic
en.wikipedia.org/wiki/Fundamental_theorem_of_arithmetic : every integer has an unique factorization. So you can use the exponents of the primes (in the factorization) to encode tuples. The easiest way to encode an n-tuple is to use only the exponents of the first n-primes (e.g. 2^x 3^y 5^z), but as noted by Raphael it is not a bijection; an alternate way is to "shift" the remaining primes as I wrote above.