Take the 2-minute tour ×

In a book for C# I read that there is direct way to convert from binary to hexadecimal:

  1. convert to nibbles with leading zeros
  2. replace with the hexadecimal representation of the nibble

The rule is divide the binary number into groups containing the number of the power to which we want to convert. 16 = 2 to power 4, so 4 digits.

I tried from base 4 to base 16: 13 33 33 = 7 f f. 4 to the power 2 is 16.

So when the "power" relation is missing (relation is 3/2), is there a way to convert from quaternary (133130) to octal(3734)?

share|improve this question
conversion in binary comes to mind : 11 111 011 100 –  Raymond Manzoni Mar 21 '12 at 21:37
I was wandering if this is possible, without binary conversion. –  Bakudan Mar 21 '12 at 21:42
Ross' method is fine for powers $p_i$ of the same base here 2 : convert $133_4\to 37_8$ and $130_4\to 34_8$ say using a lookup table with $2^{LCM(p_1,p_2)}$ entries (64 here) if the LCM of the powers is not too high. –  Raymond Manzoni Mar 21 '12 at 22:41

1 Answer 1

up vote 3 down vote accepted

You can group the digits. As an octal digit accounts for 3 binary bits and a quaternary digit accounts for 2, the LCM of these is 6. So you can take pairs octal digits and convert them to three quaternary digits (like $33_8=123_4$) or vice versa. In a sense, you are going through binary, but in a hidden way. This still depends upon both bases of interest being powers of the same number (here, 2)

share|improve this answer

Your Answer


