Conversion base $r$ to base $10$ (decimal) Algorithm

320 Views Asked by At

There's another algorithm for converting from base r to base 10? The only one I know is the following one:

For example 20 (base 5) to base 10 is: $2X5^1 + 0x5^0 = 10.$

1

There are 1 best solutions below

0
On

Well, I wrote something but realized it doesn't work. If you really want to do something differently for small numbers like 2 digit numbers then,

Divide the number into two parts - one with only even number digits, the other with only $1$'s and $0$'s.

$$34_{(5)}=24_{(5)}+10_{(5)}$$

For the first part yo just divide by 2 digit by digit.

$$24_{(5)}=12_{(10)}$$

For the other part, just do the normal way, but it should be easier as there are only $1$ or $0$. And then you add those two numbers.