The Gray code is sometimes called a reflected code because the bit values are reflected on both sides of any 2″ value. For example, as shown in Table 3-5, the values of the three low-order bits are reflected over a line drawn between 7 and 8. Using this property of the Gray code, obtain:
a. The Gray code numbers for 16 through 31 as a continuation of Table 3-5.
b. The excess-3 Gray code for decimals 10 to 19 as a continuation of the list in Table 3-6.

The Correct Answer and Explanation is :
Part (a): Gray Code Numbers for 16 through 31
To generate the Gray code numbers for 16 through 31, we start by recalling the Gray code conversion method. The Gray code for a number (N) is calculated by performing an XOR operation between (N) and the number (N >> 1) (right-shifted value of (N)).
The table of Gray codes from 16 to 31 is obtained by following this procedure.
| Decimal | Binary | Gray Code |
|---|---|---|
| 16 | 10000 | 11000 |
| 17 | 10001 | 11001 |
| 18 | 10010 | 11011 |
| 19 | 10011 | 11010 |
| 20 | 10100 | 11110 |
| 21 | 10101 | 11111 |
| 22 | 10110 | 11101 |
| 23 | 10111 | 11100 |
| 24 | 11000 | 10100 |
| 25 | 11001 | 10101 |
| 26 | 11010 | 10111 |
| 27 | 11011 | 10110 |
| 28 | 11100 | 10010 |
| 29 | 11101 | 10011 |
| 30 | 11110 | 10001 |
| 31 | 11111 | 10000 |
Explanation:
- The Gray code for any binary number can be generated by XORing the binary number with itself right-shifted by one bit. For example, for 16, in binary it’s (10000), and its Gray code is generated as follows: XOR(10000, 01000) = 11000.
- The table above demonstrates the conversion of decimal numbers 16 through 31 to Gray code using this method.
Part (b): Excess-3 Gray Code for Decimals 10 to 19
Excess-3 is a binary-coded decimal (BCD) system where each decimal digit is represented by its corresponding binary equivalent plus 3. After this transformation, the result is used in generating the Gray code.
To get the Excess-3 Gray code, first add 3 to each decimal number (10 to 19) and convert the result to binary. Then, convert this binary value to Gray code.
| Decimal | Excess-3 | Binary (Excess-3) | Gray Code (Excess-3) |
|---|---|---|---|
| 10 | 13 | 1101 | 1111 |
| 11 | 14 | 1110 | 1010 |
| 12 | 15 | 1111 | 1011 |
| 13 | 16 | 10000 | 11000 |
| 14 | 17 | 10001 | 11001 |
| 15 | 18 | 10010 | 11011 |
| 16 | 19 | 10011 | 11010 |
| 17 | 20 | 10100 | 11110 |
| 18 | 21 | 10101 | 11111 |
| 19 | 22 | 10110 | 11101 |
Explanation:
- Excess-3 encoding: First, add 3 to the decimal values (10 to 19), which results in the numbers 13 to 22. These are then converted into binary, and the Gray code is generated as described in part (a).
- For example, for decimal 10, Excess-3 gives 13, which in binary is (1101), and its Gray code is (1111).
Thus, the two tables display the Gray code transformations for the specified ranges in the question.