Pairing is caring /
Dear thinking people,
letN
denote the natural numbers and let [n]
denote a set with n elements.Fix a natural number
m
.
I'm looking for a bijection between N x N
, and the function space [3] --> [m] x [6]
.
In other word, I need a one-one mapping between the pairs of natural numbers and the key-value pairs with 3 different possible keys that take values in the set of pairs from [m] x [6]
.
It might be simpler to even relax the problem and replace [m]
with N
, although I'll only be really interested in functions that map into the first m integers in that pair.
On a related note, since I know there are bored strong programmers out there, how are such small function spaces best encoded in the language C#, for example? If anyone is up for a challenge, try coding up the back and forth of the related Cantor pairing function:
https://en.wikipedia.org/wiki/Pairing_function
Best Regards
qed