2

If I have 3 numbers, how can I find one number that is unique to that combination.

E.g. (4, 3, 5) has a unique number that is not the same as (5, 3, 4).

I tried adding a number to each component (like 1 to x, 2, y, and 3 to z and then multiplying that number, but there were a lot of problems with this).

  • Are you trying to find a mapping, (a, b, c)->n where every unique triple (a, b, c) maps to a unique n? If a, b, and c are integers, then that will be possible, but it's going to be more of an algorithm than a mathematical function. – Solomon Slow Mar 05 '15 at 05:01
  • Jim, you are exactly right. And it will be an algorithm! – flyinghigh Mar 05 '15 at 05:33

1 Answers1

5

I'm assuming your numbers are non-negative; other options can be accommodated. The boring way is to use the mapping $(x,y,z) \mapsto 2^x3^y5^z$, but the resulting numbers are somewhat big. Another option is to use $$ (x,y,z) \mapsto \binom{x}{1} + \binom{x+y+1}{2} + \binom{x+y+z+2}{3}. $$ This mapping has the distinction that it is a bijection between $\mathbb{N}^3$ and $\mathbb{N}$.

Yuval Filmus
  • 57,157