show/hide this revision's text 2 edited body

To a finite set $A\subset\mathbb{N}$ assign the natural number $\sum_{a\in A}2^a$. This map is bijective and requires little computation.

Of course this method is only good when the numbers to encode are different. If you want to encode a finite sequence of natural numbers into one, then I suggest the following. Write each number dyadically and assign and change the leading "1" into a digit "2" after each of them. 2". Then concatenate these strings and interpret the resulting sequence of digits 0,1,2 in base 3.

show/hide this revision's text 1

To a finite set $A\subset\mathbb{N}$ assign the natural number $\sum_{a\in A}2^a$. This map is bijective and requires little computation.

Of course this method is only good when the numbers to encode are different. If you want to encode a finite sequence of natural numbers into one, then I suggest the following. Write each number dyadically and assign a digit "2" after each of them. Then concatenate these strings and interpret the resulting sequence of digits 0,1,2 in base 3.