I'm using a mixed-base number to represent some data. E.g. $4_6 3_6 2_6 0_3 1_3 2_3$. As you can see the bases for the first and last 3 numbers are 6 and 3 respectively.
In the past, this number had the same base (6), so it was just a matter of converting from base 6 to base 10 and I was guaranteed a unique number in base 10 for a corresponding number in base 6.
I'd like to avoid setting up a hash table where the string 432012 maps to (say) 1342.
Now, I'm trying to figure out how to do the same for this mixed-base number ; any suggestions?
Would this work?
$$4_6 3_6 2_6 0_3 1_3 2_3 = 4 \cdot 6^5 + 3 \cdot 6^4 + 2 \cdot 6^3 + 0 \cdot 3^2 + 1 \cdot 3^1 + 2 \cdot 3^0$$
With your approach, numbers from $27=1+2_32_32_3$ to $215=1_60_30_30_3-1$ are not representable. I would do $4_63_62_60_31_32_3\ \ $ as $4\cdot 6^2\cdot 3^3 + 3\cdot 6^1 \cdot 3^3 +2\cdot 6^0 \cdot 3^3 + 0\cdot 3^2+1\cdot 3^1 +2\cdot 3^0=4433.\ \ $ You have to carry from each position with its particular base. Then all numbers will be representable.