2
$\begingroup$

I have a list of tuples of integers where each number can be {0, 1, 2}. For example the tuples (1, 0, 2, 1, 0) and (2, 1, 0, 0, 0). Is there a way to identify these tuples with a unique integer representation and to be able to find them back with a bijective function ? I tried to apply the weighted sum model but I did not manage to get the result wanted.

Thank in advance

$\endgroup$
  • 1
    $\begingroup$ does (x,y,.....z) -> xy....z in base 10 expansion work? Are you using ordered tuples? $\endgroup$ – user27182 Oct 3 '16 at 12:50
  • 1
    $\begingroup$ Each ordered tuple is the unique expression of an integer in base 3 (or base 10, as @user27182 says), so the map in injective. It's not bijective unless your list has all the tuples (of some fixed length). $\endgroup$ – Ethan Bolker Oct 3 '16 at 12:56
0
$\begingroup$

Just transform the sequence into a base-$3$ number: $a_03^0+a_13^1+\cdots $

$\endgroup$
1
$\begingroup$

The function that maps $\{e_{1}, e_{2}, \dots \}$ to $p_{1}^{e_{1}} \cdot p_{2}^{e_{2}} \cdots$, where $p_{i}$ is the $i$th prime number is bijective.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.