The 3-bit Gray sequence — Gray code

coreone bit changes per step

Answer

000 001 011 010 110 111 101 100

Why this example is worth doing

The whole three-bit sequence, whose defining property is that consecutive entries differ in exactly one bit — including the wrap from the last entry back to the first, which makes it a cyclic code. The page highlights the changing bit at each step so the property is checkable at a glance rather than asserted, and this listing is what the K-map row and column labels are drawn from.

Try your own input in the Gray code. Convert binary to reflected Gray code and back, and build the sequence by reflection.

How the answer is reached

3-bit binary reflected Gray code

L1 = [0, 1]. For each extra bit, write the list, write it reversed below the mirror line, then prefix 0 to the top half and 1 to the bottom half.

3-bit binary reflected Gray code — columns bits, sequence
bitssequence
10, 1
200, 01, 11, 10
3000, 001, 011, 010, 110, 111, 101, 100

Consecutive codewords differ in exactly one bit, and so do the last and the first: the code is cyclic.

Warning:

This is the binary reflected Gray code. It is one Gray code among many: any single-bit-change ordering of the codewords is a Gray code, and other constructions give different tables.

Source: Frank Gray, US Patent 2,632,058, "Pulse Code Communication" (filed 1947, granted 1953)

Compare with

Open the Gray code

This input is entered in the tool itself — it is too rich for a link to carry.

Note:

Notation this page assumes

  • Bit strings are written most significant bit first, and bit 0 is the least significant bit.
  • A width is stated explicitly wherever it changes the answer; nothing is silently sign-extended or truncated.
  • Gray code here is the reflected binary code, generated by reflection, with the least significant bit changing first.

Sources

  • Gray, “Pulse Code Communication”, US Patent 2,632,058 (1953)