A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

One Step

One Step
One Step
How do I convert a Base 3 number into a Base 5 number in one step?

How do I convert a Base 3 number into a Base 5 number in one step, showing the steps needed to do it? If you can explain, thank you very much, but if your unable to, thank you anyway.

I assume that when you say "in one step," you mean without converting to a decimal in between.

This is relatively easy using repeated division, provided you're comfortable with base 3 arithmetic.

Each subsequent digit starting from the right will be the remainder when you divide your current working total by 12 (5 in base 3).

The only tricky parts here are keeping track of what base you're in and remembering to convert to base 5 for each digit at the end (see the second example).

Let's demonstrate with an example:
Convert 12210 base 3 (156 in dec) to base 5:

All math is in base 3:
12210 = 12 * 1011 + 1
1011 = 12 * 20 + 1
20 = 12 * 1 + 1
1 = 12 * 0 + 1

Taking these digits in order:
1, 1, 1, 1
1111 base 5

Another example:
Convert 10211 base 3 (103 in dec) to base 5:

10211 = 12 * 202 + 10
202 = 12 * 11 + 0
11 =12 * 0 + 11

Taking these digits in order:
11, 0, 10
4, 0, 3
403 base 5

Zanti: Absolutely. If you want to work in other bases, you either have to be willing to work in those bases or convert to decimal for ease. I was just answering the question as phrased 🙂



No items matching your keywords were found.


[phpzon]One Step, 10, Photo[/phpzon]

Comments are closed.