Skip navigation

This solution is for the book I am currently reading. All of my notes and solutions are available at Google Code.

Here is my work for problem 2.2:

Problem

Fill in the blank entries in the following table, given the decimal and
hexadecimal representation of different powers of 2:


n     2^n (Decimal)       2^n (Hexadecimal)
--------------------------------------------
11        2048                 0x800
--------------------------------------------
 7
--------------------------------------------
          8192
--------------------------------------------
                             0x20000
--------------------------------------------
16
--------------------------------------------
           256
--------------------------------------------
                                0x20
--------------------------------------------

1)
  n = 7
  2^7 = Decimal form: 128
  7 = i + 4j where 0 <= i <= 3
    7 = 3 + 4 ( 1 )
    i = 3, j = 1
    Hexadecimal form: 0x80

2)
  Decimal value = 8192
  8192 log2 = n = 13
  13 = i + 4j where 0 <= i <= 3
    13 = 1 + 4 ( 3 )
    13 = 1 + 12
    i = 1, j = 3
    Hexadecimal form: 0x2000
3)
  Hexadecimal value = 0x20000
    i = 1
    j = 4
    n = i + 4j
      n = 1 + 4 * 4
      n = 1 + 16
      n = 17
   Decimal value = 2^n = 131,072

4)
  n = 16
  Decimal value = 2^n = 65,536
  n = i + 4j where 0 <= i <= 3
    16 = i + 4j
    16 = 0 + 4*4
    i = 0, j = 4
    Hexadecimal: 0x10000

5)
  Decimal value = 256
  n = 8
    8 = i + 4j where 0 <= i <= 3
    i = 0, j = 2
    Hexadecimal value: 0x100

7)
  Hexadecimal value = 0x20
  i = 1, j= 1
  n = i + 4j
  n = 1 + 4*1
  n = 5
  Decimal value = 2^n = 2^5 = 32

n     2^n (Decimal)       2^n (Hexadecimal)
--------------------------------------------
11        2048                 0x800
--------------------------------------------
 7         128                  0x80
--------------------------------------------
13         8192               0x2000
--------------------------------------------
17       131072              0x20000
--------------------------------------------
16        65536              0x10000
--------------------------------------------
 8          256                0x100
--------------------------------------------
 5           32                 0x20
--------------------------------------------

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: