this post was submitted on 04 Nov 2023
10 points (100.0% liked)
A place for everything about math
886 readers
1 users here now
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Here's how you can do it while only ever dividing or multiplying by two.
Decimal to quaternary
This is a cycle of looking at remainders from dividing by two, with the first one an odd-even determinant, and the second a big-little determinant for each quaternary digit. You make numbers even before dividing by two, so there are never fractions to consider.
Example
Decimal number is 57~10~.
Next round:—
Final digit:—
That process gives 57~10~ = 321~4~; that is, 3 sixteens, 2 fours and 1.
Quaternary to decimal
Here you only need to add a small number and then double twice with each digit.
Example
Quaternary number is 321~4~.
Next round:—
Final digit:—
So 321~4~ = 57~10~.