30 June 2006

A Simple Conversion (1.3.1, 1)

Knuth asks:

The binary form of 2009 is (11111011001)2; what is 2009 in hexadecimal?


To obtain the hexadecimal representation, we group the bits of the binary representation into four bits at a time, starting from the rightmost bit. We then replace the nybbles with the corresponding hexadecimal digit:

(11111011001)2
= {1001=9, 1101=d, 0111=7}
#7d9