Professional Documents
Culture Documents
It does not work for 5 and 20 but it does work for 4 and 16. If you
have a number like 12132 in base 4, you group the digits in pairs from
the right, as "01 21 32" and rewrite converting each of those 2-digit
base 4 numbers to one base-16 digit, giving 19E in hexadecimal.
Perhaps you don't see right off why we take pairs in this situation
and groups of 3 in the other. Here is why it works. It is all related
to the Distributive Law, which says that for any 3 numbers x, y, and
z, (x + y)*z = x*z + y*z. That is how you "multiply out" if you go
from the left side to the right side. If you have something like what
is on the right side, this tells you how to "factor out" the z. Let's
use that. The base 4 number 12132 stands for the base 10 expression
where the "^" indicates a power or exponent. Since 4^1 is just 4 and
4^0 is 1, this can also be written as
Now, to make the next step clearer, I'll add some parentheses to focus
attention on parts of the expression.
It's important that you understand why this change gives an equivalent
expression. (Also, this shows why the method works only when the
larger base is a power of the smaller base, as 8 is a power of 2 for
the original example, and 16 is a power of 4 in this example.) Now we
factor out the 16 to get another equivalent expression.
19E
Similar logic works to show why the original binary to octal technique
works. Follow the example above and do it to satisfy yourself why and
how that works. In that case, you are going from powers of 2 to powers
of 8.
I said this type of conversion technique works only when the larger
base is a power of the smaller. Strictly, that is true. But a closely
related process works when the two bases are BOTH powers of something
smaller. Converting from octal to hexadecimal is fairly easy if you
do it in two steps. First convert from octal to binary, and then
convert from binary to hexadecimal.
Go to it.