Lucal code^{[1]}^{[2]}  

5  4  3  2  1  
Gray code  
4  3  2  1  
0  0  0  0  0  0 
1  0  0  0  1  1 
2  0  0  1  1  0 
3  0  0  1  0  1 
4  0  1  1  0  0 
5  0  1  1  1  1 
6  0  1  0  1  0 
7  0  1  0  0  1 
8  1  1  0  0  0 
9  1  1  0  1  1 
10  1  1  1  1  0 
11  1  1  1  0  1 
12  1  0  1  0  0 
13  1  0  1  1  1 
14  1  0  0  1  0 
15  1  0  0  0  1 
The reflected binary code (RBC), also known just as reflected binary (RB) or Gray code after Frank Gray, is an ordering of the binary numeral system such that two successive values differ in only one bit (binary digit).
For example, the representation of the decimal value "1" in binary would normally be "001" and "2" would be "010". In Gray code, these values are represented as "001" and "011". That way, incrementing a value from 1 to 2 requires only one bit to change, instead of two.
Gray codes are widely used to prevent spurious output from electromechanical switches and to facilitate error correction in digital communications such as digital terrestrial television and some cable TV systems.
Motivation and name
Many devices indicate position by closing and opening switches. If that device uses natural binary codes, positions 3 and 4 are next to each other but all three bits of the binary representation differ:
Decimal  Binary 

...  ... 
3  011 
4  100 
...  ... 
The problem with natural binary codes is that physical switches are not ideal: it is very unlikely that physical switches will change states exactly in synchrony. In the transition between the two states shown above, all three switches change state. In the brief period while all are changing, the switches will read some spurious position. Even without keybounce, the transition might look like 011 — 001 — 101 — 100. When the switches appear to be in position 001, the observer cannot tell if that is the "real" position 001, or a transitional state between two other positions. If the output feeds into a sequential system, possibly via combinational logic, then the sequential system may store a false value.
This problem can be solved by changing only one switch at a time, so there is never any ambiguity of position, resulting in codes assigning to each of a contiguous set of integers, or to each member of a circular list, a word of symbols such that no two code words are identical and each two adjacent code words differ by exactly one symbol. These codes are also known as unitdistance,^{[3]}^{[4]}^{[5]}^{[6]}^{[7]} singledistance, singlestep, monostrophic^{[8]}^{[9]}^{[6]}^{[7]} or syncopic codes,^{[8]} in reference to the Hamming distance of 1 between adjacent codes.
In principle, there can be more than one such code for a given word length, but the term Gray code was first applied to a particular binary code for nonnegative integers, the binaryreflected Gray code, or BRGC. Bell Labs researcher George R. Stibitz described such a code in a 1941 patent application, granted in 1943.^{[10]}^{[11]}^{[12]} Frank Gray introduced the term reflected binary code in his 1947 patent application, remarking that the code had "as yet no recognized name".^{[13]} He derived the name from the fact that it "may be built up from the conventional binary code by a sort of reflection process".
In the standard encoding the least significant bit follows a repetitive pattern of 2 on, 2 off ( … 11001100 … ); the next digit a pattern of 4 on, 4 off; the nth least significant bit a pattern of on off. The fourbit version of this is shown below:
Decimal  Binary  Gray  Gray Decimal 

0  0000  0000  0 
1  0001  0001  1 
2  0010  0011  3 
3  0011  0010  2 
4  0100  0110  6 
5  0101  0111  7 
6  0110  0101  5 
7  0111  0100  4 
8  1000  1100  12 
9  1001  1101  13 
10  1010  1111  15 
11  1011  1110  14 
12  1100  1010  10 
13  1101  1011  11 
14  1110  1001  9 
15  1111  1000  8 
For decimal 15 the code rolls over to decimal 0 with only one switch change. This is called the cyclic or adjacency property of the code.^{[14]}
In modern digital communications, Gray codes play an important role in error correction. For example, in a digital modulation scheme such as QAM where data is typically transmitted in symbols of 4 bits or more, the signal's constellation diagram is arranged so that the bit patterns conveyed by adjacent constellation points differ by only one bit. By combining this with forward error correction capable of correcting singlebit errors, it is possible for a receiver to correct any transmission errors that cause a constellation point to deviate into the area of an adjacent point. This makes the transmission system less susceptible to noise.
Despite the fact that Stibitz described this code^{[10]}^{[11]}^{[12]} before Gray, the reflected binary code was later named after Gray by others who used it. Two different 1953 patent applications use "Gray code" as an alternative name for the "reflected binary code";^{[15]}^{[16]} one of those also lists "minimum error code" and "cyclic permutation code" among the names.^{[16]} A 1954 patent application refers to "the Bell Telephone Gray code".^{[17]} Other names include "cyclic binary code",^{[11]} "cyclic progression code",^{[18]}^{[11]} "cyclic permuting binary"^{[19]} or "cyclic permuted binary" (CPB).^{[20]}^{[21]}
The Gray code was sometimes attributed, incorrectly,^{[12]} to Elisha Gray.^{[22]}^{[23]}^{[24]}
History and practical application
Mathematical puzzles
Reflected binary codes were applied to mathematical puzzles before they became known to engineers.
The binaryreflected Gray code represents the underlying scheme of the classical Chinese rings puzzle, a sequential mechanical puzzle mechanism described by the French Louis Gros in 1872.^{[25]}^{[12]}
It can serve as a solution guide for the Towers of Hanoi problem, based on a game by the French Édouard Lucas in 1883.^{[26]}^{[27]}^{[28]}^{[29]} Similarly, the so called Towers of Bucharest and Towers of Klagenfurt game configurations yield ternary and pentary Gray codes.^{[30]}
Martin Gardner wrote a popular account of the Gray code in his August 1972 Mathematical Games column in Scientific American.^{[31]}
The code also forms a Hamiltonian cycle on a hypercube, where each bit is seen as one dimension.
Telegraphy codes
When the French engineer Émile Baudot changed from using a 6unit (6bit) code to 5unit code for his printing telegraph system, in 1875^{[32]} or 1876,^{[33]}^{[34]} he ordered the alphabetic characters on his print wheel using a reflected binary code, and assigned the codes using only three of the bits to vowels. With vowels and consonants sorted in their alphabetical order,^{[35]}^{[36]}^{[37]} and other symbols appropriately placed, the 5bit character code has been recognized as a reflected binary code.^{[12]} This code became known as Baudot code^{[38]} and, with minor changes, was eventually adopted as International Telegraph Alphabet No. 1 (ITA1, CCITT1) in 1932.^{[39]}^{[40]}^{[37]}
About the same time, the GermanAustrian Otto Schäffler ^{[41]} demonstrated another printing telegraph in Vienna using a 5bit reflected binary code for the same purpose, in 1874.^{[42]}^{[12]}
Analogtodigital signal conversion
Frank Gray, who became famous for inventing the signaling method that came to be used for compatible color television, invented a method to convert analog signals to reflected binary code groups using vacuum tubebased apparatus. Filed in 1947, the method and apparatus were granted a patent in 1953,^{[13]} and the name of Gray stuck to the codes. The "PCM tube" apparatus that Gray patented was made by Raymond W. Sears of Bell Labs, working with Gray and William M. Goodall, who credited Gray for the idea of the reflected binary code.^{[43]}
Gray was most interested in using the codes to minimize errors in converting analog signals to digital; his codes are still used today for this purpose.
Position encoders
Gray codes are used in linear and rotary position encoders (absolute encoders and quadrature encoders) in preference to weighted binary encoding. This avoids the possibility that, when multiple bits change in the binary representation of a position, a misread will result from some of the bits changing before others.
For example, some rotary encoders provide a disk which has an electrically conductive Gray code pattern on concentric rings (tracks). Each track has a stationary metal spring contact that provides electrical contact to the conductive code pattern. Together, these contacts produce output signals in the form of a Gray code. Other encoders employ noncontact mechanisms based on optical or magnetic sensors to produce the Gray code output signals.
Regardless of the mechanism or precision of a moving encoder, position measurement error can occur at specific positions (at code boundaries) because the code may be changing at the exact moment it is read (sampled). A binary output code could cause significant position measurement errors because it is impossible to make all bits change at exactly the same time. If, at the moment the position is sampled, some bits have changed and others have not, the sampled position will be incorrect. In the case of absolute encoders, the indicated position may be far away from the actual position and, in the case of incremental encoders, this can corrupt position tracking.
In contrast, the Gray code used by position encoders ensures that the codes for any two consecutive positions will differ by only one bit and, consequently, only one bit can change at a time. In this case, the maximum position error will be small, indicating a position adjacent to the actual position.
Genetic algorithms
Due to the Hamming distance properties of Gray codes, they are sometimes used in genetic algorithms.^{[14]} They are very useful in this field, since mutations in the code allow for mostly incremental changes, but occasionally a single bitchange can cause a big leap and lead to new properties.
Boolean circuit minimization
Gray codes are also used in labelling the axes of Karnaugh maps since 1953^{[44]}^{[45]}^{[46]} as well as in Händler circle graphs since 1958,^{[47]}^{[48]}^{[49]}^{[50]} both graphical methods for logic circuit minimization.
Error correction
In modern digital communications, Gray codes play an important role in error correction. For example, in a digital modulation scheme such as QAM where data is typically transmitted in symbols of 4 bits or more, the signal's constellation diagram is arranged so that the bit patterns conveyed by adjacent constellation points differ by only one bit. By combining this with forward error correction capable of correcting singlebit errors, it is possible for a receiver to correct any transmission errors that cause a constellation point to deviate into the area of an adjacent point. This makes the transmission system less susceptible to noise.
Communication between clock domains
Digital logic designers use Gray codes extensively for passing multibit count information between synchronous logic that operates at different clock frequencies. The logic is considered operating in different "clock domains". It is fundamental to the design of large chips that operate with many different clocking frequencies.
Cycling through states with minimal effort
If a system has to cycle through all possible combinations of onoff states of some set of controls, and the changes of the controls require nontrivial expense (e.g. time, wear, human work), a Gray code minimizes the number of setting changes to just one change for each combination of states. An example would be testing a piping system for all combinations of settings of its manually operated valves.
A balanced Gray code can be constructed,^{[51]} that flips every bit equally often. Since bitflips are evenly distributed, this is optimal in the following way: balanced Gray codes minimize the maximal count of bitflips for each digit.
Gray code counters and arithmetic
George R. Stibitz utilized a reflected binary code in a binary pulse counting device in 1941 already.^{[10]}^{[11]}^{[12]}
A typical use of Gray code counters is building a FIFO (firstin, firstout) data buffer that has read and write ports that exist in different clock domains. The input and output counters inside such a dualport FIFO are often stored using Gray code to prevent invalid transient states from being captured when the count crosses clock domains.^{[52]} The updated read and write pointers need to be passed between clock domains when they change, to be able to track FIFO empty and full status in each domain. Each bit of the pointers is sampled nondeterministically for this clock domain transfer. So for each bit, either the old value or the new value is propagated. Therefore, if more than one bit in the multibit pointer is changing at the sampling point, a "wrong" binary value (neither new nor old) can be propagated. By guaranteeing only one bit can be changing, Gray codes guarantee that the only possible sampled values are the new or old multibit value. Typically Gray codes of poweroftwo length are used.
Sometimes digital buses in electronic systems are used to convey quantities that can only increase or decrease by one at a time, for example the output of an event counter which is being passed between clock domains or to a digitaltoanalog converter. The advantage of Gray codes in these applications is that differences in the propagation delays of the many wires that represent the bits of the code cannot cause the received value to go through states that are out of the Gray code sequence. This is similar to the advantage of Gray codes in the construction of mechanical encoders, however the source of the Gray code is an electronic counter in this case. The counter itself must count in Gray code, or if the counter runs in binary then the output value from the counter must be reclocked after it has been converted to Gray code, because when a value is converted from binary to Gray code,^{[nb 1]} it is possible that differences in the arrival times of the binary data bits into the binarytoGray conversion circuit will mean that the code could go briefly through states that are wildly out of sequence. Adding a clocked register after the circuit that converts the count value to Gray code may introduce a clock cycle of latency, so counting directly in Gray code may be advantageous.^{[53]}
To produce the next count value in a Graycode counter, it is necessary to have some combinational logic that will increment the current count value that is stored. One way to increment a Gray code number is to convert it into ordinary binary code,^{[54]} add one to it with a standard binary adder, and then convert the result back to Gray code.^{[55]} Other methods of counting in Gray code are discussed in a report by Robert W. Doran, including taking the output from the first latches of the masterslave flip flops in a binary ripple counter.^{[56]}
Gray code addressing
As the execution of program code typically causes an instruction memory access pattern of locally consecutive addresses, bus encodings using Gray code addressing instead of binary addressing can reduce the number of state changes of the address bits significantly, thereby reducing the CPU power consumption in some lowpower designs.^{[57]}^{[58]}
Constructing an nbit Gray code
The binaryreflected Gray code list for n bits can be generated recursively from the list for n − 1 bits by reflecting the list (i.e. listing the entries in reverse order), prefixing the entries in the original list with a binary 0, prefixing the entries in the reflected list with a binary 1, and then concatenating the original list with the reversed list.^{[12]} For example, generating the n = 3 list from the n = 2 list:
2bit list:  00, 01, 11, 10  
Reflected:  10, 11, 01, 00  
Prefix old entries with 0:  000, 001, 011, 010,  
Prefix new entries with 1:  110, 111, 101, 100  
Concatenated:  000, 001, 011, 010,  110, 111, 101, 100 
The onebit Gray code is G_{1} = (0, 1). This can be thought of as built recursively as above from a zerobit Gray code G_{0} = ( Λ ) consisting of a single entry of zero length. This iterative process of generating G_{n+1} from G_{n} makes the following properties of the standard reflecting code clear:
 G_{n} is a permutation of the numbers 0, …, 2^{n} − 1. (Each number appears exactly once in the list.)
 G_{n} is embedded as the first half of G_{n+1}.
 Therefore, the coding is stable, in the sense that once a binary number appears in G_{n} it appears in the same position in all longer lists; so it makes sense to talk about the reflective Gray code value of a number: G(m) = the mth reflecting Gray code, counting from 0.
 Each entry in G_{n} differs by only one bit from the previous entry. (The Hamming distance is 1.)
 The last entry in G_{n} differs by only one bit from the first entry. (The code is cyclic.)
These characteristics suggest a simple and fast method of translating a binary value into the corresponding Gray code. Each bit is inverted if the next higher bit of the input value is set to one. This can be performed in parallel by a bitshift and exclusiveor operation if they are available: the nth Gray code is obtained by computing . Prepending a 0 leaves the order of the code words unchanged, prepending a 1 reverses the order of the code words. If the bits at position of codewords are inverted, the order of neighbouring blocks of codewords is reversed. E.g. if bit 0 is inverted in a 3 bit codeword sequence, the order of two neighbouring codewords is reversed
{000,001,010,011,100,101,110,111} → {001,000,011,010,101,100,111,110} (invert bit 0)
If bit 1 is inverted, blocks of 2 codewords change order:
{000,001,010,011,100,101,110,111} → {010,011,000,001,110,111,100,101} (invert bit 1)
If bit 2 is inverted, blocks of 4 codewords reverse order:
{000,001,010,011,100,101,110,111} → {100,101,110,111,000,001,010,011} (invert bit 2)
Thus, exoring a bit at position with the bit at position leaves the order of codewords intact if , and reverses the order of blocks of codewords if . Now, this is exactly the same operation as the reflectandprefix method to generate the Gray code.
A similar method can be used to perform the reverse translation, but the computation of each bit depends on the computed value of the next higher bit so it cannot be performed in parallel. Assuming is the th Graycoded bit ( being the most significant bit), and is the th binarycoded bit ( being the mostsignificant bit), the reverse translation can be given recursively: , and . Alternatively, decoding a Gray code into a binary number can be described as a prefix sum of the bits in the Gray code, where each individual summation operation in the prefix sum is performed modulo two.
To construct the binaryreflected Gray code iteratively, at step 0 start with the , and at step find the bit position of the least significant 1 in the binary representation of and flip the bit at that position in the previous code to get the next code . The bit positions start 0, 1, 0, 2, 0, 1, 0, 3, ….^{[nb 2]} See find first set for efficient algorithms to compute these values.
Converting to and from Gray code
The following functions in C convert between binary numbers and their associated Gray codes. While it may seem that Graytobinary conversion requires each bit to be handled one at a time, faster algorithms exist.^{[59]}^{[54]}^{[nb 1]}
typedef unsigned int uint;
// This function converts an unsigned binary number to reflected binary Gray code.
uint BinaryToGray(uint num)
{
return num ^ (num >> 1); // The operator >> is shift right. The operator ^ is exclusive or.
}
// This function converts a reflected binary Gray code number to a binary number.
uint GrayToBinary(uint num)
{
uint mask = num;
while (mask) { // Each Gray code bit is exclusiveored with all more significant bits.
mask >>= 1;
num ^= mask;
}
return num;
}
// A more efficient version for Gray codes 32 bits or fewer through the use of SWAR (SIMD within a register) techniques.
// It implements a parallel prefix XOR function. The assignment statements can be in any order.
//
// This function can be adapted for longer Gray codes by adding steps.
uint GrayToBinary32(uint num)
{
num ^= num >> 16;
num ^= num >> 8;
num ^= num >> 4;
num ^= num >> 2;
num ^= num >> 1;
return num;
}
// A Fourbitatonce variant changes a binary number (abcd)2 to (abcd)2 ^ (00ab)2, then to (abcd)2 ^ (00ab)2 ^ (0abc)2 ^ (000a)2.
Special types of Gray codes
In practice, "Gray code" almost always refers to a binaryreflected Gray code (BRGC). However, mathematicians have discovered other kinds of Gray codes. Like BRGCs, each consists of a list of words, where each word differs from the next in only one digit (each word has a Hamming distance of 1 from the next word).
nary Gray code

There are many specialized types of Gray codes other than the binaryreflected Gray code. One such type of Gray code is the nary Gray code, also known as a nonBoolean Gray code. As the name implies, this type of Gray code uses nonBoolean values in its encodings.
For example, a 3ary (ternary) Gray code would use the values {0, 1, 2}.^{[30]} The (n, k)Gray code is the nary Gray code with k digits.^{[60]} The sequence of elements in the (3, 2)Gray code is: {00, 01, 02, 12, 11, 10, 20, 21, 22}. The (n, k)Gray code may be constructed recursively, as the BRGC, or may be constructed iteratively. An algorithm to iteratively generate the (N, k)Gray code is presented (in C):
// inputs: base, digits, value
// output: Gray
// Convert a value to a Gray code with the given base and digits.
// Iterating through a sequence of values would result in a sequence
// of Gray codes in which only one digit changes at a time.
void toGray(unsigned base, unsigned digits, unsigned value, unsigned gray[digits])
{
unsigned baseN[digits]; // Stores the ordinary baseN number, one digit per entry
unsigned i; // The loop variable
// Put the normal baseN number into the baseN array. For base 10, 109
// would be stored as [9,0,1]
for (i = 0; i < digits; i++) {
baseN[i] = value % base;
value = value / base;
}
// Convert the normal baseN number into the Gray code equivalent. Note that
// the loop starts at the most significant digit and goes down.
unsigned shift = 0;
while (i) {
// The Gray digit gets shifted down by the sum of the higher
// digits.
gray[i] = (baseN[i] + shift) % base;
shift = shift + base  gray[i]; // Subtract from base so shift is positive
}
}
// EXAMPLES
// input: value = 1899, base = 10, digits = 4
// output: baseN[] = [9,9,8,1], gray[] = [0,1,7,1]
// input: value = 1900, base = 10, digits = 4
// output: baseN[] = [0,0,9,1], gray[] = [0,1,8,1]
There are other Gray code algorithms for (n,k)Gray codes. The (n,k)Gray code produced by the above algorithm is always cyclical; some algorithms, such as that by Guan,^{[60]} lack this property when k is odd. On the other hand, while only one digit at a time changes with this method, it can change by wrapping (looping from n − 1 to 0). In Guan's algorithm, the count alternately rises and falls, so that the numeric difference between two Gray code digits is always one.
Gray codes are not uniquely defined, because a permutation of the columns of such a code is a Gray code too. The above procedure produces a code in which the lower the significance of a digit, the more often it changes, making it similar to normal counting methods.
See also Skew binary number system, a variant ternary number system where at most 2 digits change on each increment, as each increment can be done with at most one digit carry operation.
Balanced Gray code
Although the binary reflected Gray code is useful in many scenarios, it is not optimal in certain cases because of a lack of "uniformity".^{[51]} In balanced Gray codes, the number of changes in different coordinate positions are as close as possible. To make this more precise, let G be an Rary complete Gray cycle having transition sequence ; the transition counts (spectrum) of G are the collection of integers defined by
A Gray code is uniform or uniformly balanced if its transition counts are all equal, in which case we have for all k. Clearly, when , such codes exist only if n is a power of 2. Otherwise, if n does not divide evenly, it is possible to construct wellbalanced codes where every transition count is either or .^{[dubious – discuss]}^{[51]} Gray codes can also be exponentially balanced if all of their transition counts are adjacent powers of two, and such codes exist for every power of two.^{[61]}
For example, a balanced 4bit Gray code has 16 transitions, which can be evenly distributed among all four positions (four transitions per position), making it uniformly balanced:^{[51]}
0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 1 1 1 0 0 0 0 0 1 1 0 0 0 0 0 1 1 1 1 1 1
whereas a balanced 5bit Gray code has a total of 32 transitions, which cannot be evenly distributed among the positions. In this example, four positions have six transitions each, and one has eight:^{[51]}
1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 1 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 1 1 1 1 1
We will now show a construction^{[62]} and implementation^{[63]} for wellbalanced binary Gray codes which allows us to generate an ndigit balanced Gray code for every n. The main principle is to inductively construct an (n + 2)digit Gray code given an ndigit Gray code G in such a way that the balanced property is preserved. To do this, we consider partitions of into an even number L of nonempty blocks of the form
where , and ). This partition induces an digit Gray code given by
If we define the transition multiplicities to be the number of times the digit in position i changes between consecutive blocks in a partition, then for the (n + 2)digit Gray code induced by this partition the transition spectrum is
The delicate part of this construction is to find an adequate partitioning of a balanced ndigit Gray code such that the code induced by it remains balanced, but for this only the transition multiplicities matter; joining two consecutive blocks over a digit transition and splitting another block at another digit transition produces a different Gray code with exactly the same transition spectrum , so one may for example^{[61]} designate the first transitions at digit as those that fall between two blocks. Uniform codes can be found when and , and this construction can be extended to the Rary case as well.^{[62]}
Long Run Gray codes
Long Run Gray codes maximize the distance between consecutive changes of digits in the same position. That is, the minimum runlength of any bit remains unchanged for as long as possible.^{[citation needed]}
Monotonic Gray codes
Monotonic codes are useful in the theory of interconnection networks, especially for minimizing dilation for linear arrays of processors.^{[64]} If we define the weight of a binary string to be the number of 1s in the string, then although we clearly cannot have a Gray code with strictly increasing weight, we may want to approximate this by having the code run through two adjacent weights before reaching the next one.
We can formalize the concept of monotone Gray codes as follows: consider the partition of the hypercube into levels of vertices that have equal weight, i.e.
for . These levels satisfy . Let be the subgraph of induced by , and let be the edges in . A monotonic Gray code is then a Hamiltonian path in such that whenever comes before in the path, then .
An elegant construction of monotonic ndigit Gray codes for any n is based on the idea of recursively building subpaths of length having edges in .^{[64]} We define , whenever or , and
otherwise. Here, is a suitably defined permutation and refers to the path P with its coordinates permuted by . These paths give rise to two monotonic ndigit Gray codes and given by
The choice of which ensures that these codes are indeed Gray codes turns out to be . The first few values of are shown in the table below.
j = 0  j = 1  j = 2  j = 3  

n = 1  0, 1  
n = 2  00, 01  10, 11  
n = 3  000, 001  100, 110, 010, 011  101, 111  
n = 4  0000, 0001 
1000, 1100, 0100, 0110, 0010, 0011 
1010, 1011, 1001, 1101, 0101, 0111 
1110, 1111 
These monotonic Gray codes can be efficiently implemented in such a way that each subsequent element can be generated in O(n) time. The algorithm is most easily described using coroutines.
Monotonic codes have an interesting connection to the Lovász conjecture, which states that every connected vertextransitive graph contains a Hamiltonian path. The "middlelevel" subgraph is vertextransitive (that is, its automorphism group is transitive, so that each vertex has the same "local environment"" and cannot be differentiated from the others, since we can relabel the coordinates as well as the binary digits to obtain an automorphism) and the problem of finding a Hamiltonian path in this subgraph is called the "middlelevels problem", which can provide insights into the more general conjecture. The question has been answered affirmatively for , and the preceding construction for monotonic codes ensures a Hamiltonian path of length at least 0.839N where N is the number of vertices in the middlelevel subgraph.^{[65]}
Beckett–Gray code
Another type of Gray code, the Beckett–Gray code, is named for Irish playwright Samuel Beckett, who was interested in symmetry. His play "Quad" features four actors and is divided into sixteen time periods. Each period ends with one of the four actors entering or leaving the stage. The play begins with an empty stage, and Beckett wanted each subset of actors to appear on stage exactly once.^{[66]} Clearly the set of actors currently on stage can be represented by a 4bit binary Gray code. Beckett, however, placed an additional restriction on the script: he wished the actors to enter and exit so that the actor who had been on stage the longest would always be the one to exit. The actors could then be represented by a first in, first out queue, so that (of the actors onstage) the actor being dequeued is always the one who was enqueued first.^{[66]} Beckett was unable to find a Beckett–Gray code for his play, and indeed, an exhaustive listing of all possible sequences reveals that no such code exists for n = 4. It is known today that such codes do exist for n = 2, 5, 6, 7, and 8, and do not exist for n = 3 or 4. An example of an 8bit Beckett–Gray code can be found in Donald Knuth's Art of Computer Programming.^{[12]} According to Sawada and Wong, the search space for n = 6 can be explored in 15 hours, and more than 9,500 solutions for the case n = 7 have been found.^{[67]}
Snakeinthebox codes
Snakeinthebox codes, or snakes, are the sequences of nodes of induced paths in an ndimensional hypercube graph, and coilinthebox codes,^{[68]} or coils, are the sequences of nodes of induced cycles in a hypercube. Viewed as Gray codes, these sequences have the property of being able to detect any singlebit coding error. Codes of this type were first described by William H. Kautz in the late 1950s;^{[4]} since then, there has been much research on finding the code with the largest possible number of codewords for a given hypercube dimension.
Singletrack Gray code
Yet another kind of Gray code is the singletrack Gray code (STGC) developed by Norman B. Spedding^{[69]}^{[70]} and refined by Hiltgen, Paterson and Brandestini in "Singletrack Gray codes" (1996).^{[71]}^{[72]} The STGC is a cyclical list of P unique binary encodings of length n such that two consecutive words differ in exactly one position, and when the list is examined as a P × n matrix, each column is a cyclic shift of the first column.^{[73]}
The name comes from their use with rotary encoders, where a number of tracks are being sensed by contacts, resulting for each in an output of 0 or 1. To reduce noise due to different contacts not switching at exactly the same moment in time, one preferably sets up the tracks so that the data output by the contacts are in Gray code. To get high angular accuracy, one needs lots of contacts; in order to achieve at least 1 degree accuracy, one needs at least 360 distinct positions per revolution, which requires a minimum of 9 bits of data, and thus the same number of contacts.
If all contacts are placed at the same angular position, then 9 tracks are needed to get a standard BRGC with at least 1 degree accuracy. However, if the manufacturer moves a contact to a different angular position (but at the same distance from the center shaft), then the corresponding "ring pattern" needs to be rotated the same angle to give the same output. If the most significant bit (the inner ring in Figure 1) is rotated enough, it exactly matches the next ring out. Since both rings are then identical, the inner ring can be cut out, and the sensor for that ring moved to the remaining, identical ring (but offset at that angle from the other sensor on that ring). Those two sensors on a single ring make a quadrature encoder. That reduces the number of tracks for a "1 degree resolution" angular encoder to 8 tracks. Reducing the number of tracks still further can't be done with BRGC.
For many years, Torsten Sillke^{[74]} and other mathematicians believed that it was impossible to encode position on a single track such that consecutive positions differed at only a single sensor, except for the 2sensor, 1track quadrature encoder. So for applications where 8 tracks were too bulky, people used singletrack incremental encoders (quadrature encoders) or 2track "quadrature encoder + reference notch" encoders.
Norman B. Spedding, however, registered a patent in 1994 with several examples showing that it was possible.^{[69]} Although it is not possible to distinguish 2^{n} positions with n sensors on a single track, it is possible to distinguish close to that many. Etzion and Paterson conjecture that when n is itself a power of 2, n sensors can distinguish at most 2^{n} − 2n positions and that for prime n the limit is 2^{n} − 2 positions.^{[75]} The authors went on to generate a 504 position single track code of length 9 which they believe is optimal. Since this number is larger than 2^{8} = 256, more than 8 sensors are required by any code, although a BRGC could distinguish 512 positions with 9 sensors.
An STGC for P = 30 and n = 5 is reproduced here:
Angle  Code  Angle  Code  Angle  Code  Angle  Code  Angle  Code  

0°  10000  72°  01000  144°  00100  216°  00010  288°  00001  
12°  10100  84°  01010  156°  00101  228°  10010  300°  01001  
24°  11100  96°  01110  168°  00111  240°  10011  312°  11001  
36°  11110  108°  01111  180°  10111  252°  11011  324°  11101  
48°  11010  120°  01101  192°  10110  264°  01011  336°  10101  
60°  11000  132°  01100  204°  00110  276°  00011  348°  10001 
Each column is a cyclic shift of the first column, and from any row to the next row only one bit changes.^{[76]} The singletrack nature (like a code chain) is useful in the fabrication of these wheels (compared to BRGC), as only one track is needed, thus reducing their cost and size. The Gray code nature is useful (compared to chain codes, also called De Bruijn sequences), as only one sensor will change at any one time, so the uncertainty during a transition between two discrete states will only be plus or minus one unit of angular measurement the device is capable of resolving.^{[77]}
Twodimensional Gray code
Twodimensional Gray codes are used in communication to minimize the number of bit errors in quadrature amplitude modulation (QAM) adjacent points in the constellation. In a typical encoding the horizontal and vertical adjacent constellation points differ by a single bit, and diagonal adjacent points differ by 2 bits.^{[78]}
Twodimensional Gray codes also have uses in location identifications schemes, where the code would be applied to area maps such as a Mercator projection of the earth's surface and an appropriate cyclic twodimensional distance function such as the Mannheim metric be used to calculate the distance between two encoded locations, thereby combining the characteristics of the Hamming distance with the cyclic continuation of a Mercator projection.^{[79]}
Gray isometry
The bijective mapping { 0 ↔ 00, 1 ↔ 01, 2 ↔ 11, 3 ↔ 10 } establishes an isometry between the metric space over the finite field with the metric given by the Hamming distance and the metric space over the finite ring (the usual modular arithmetic) with the metric given by the Lee distance. The mapping is suitably extended to an isometry of the Hamming spaces and . Its importance lies in establishing a correspondence between various "good" but not necessarily linear codes as Graymap images in of ringlinear codes from .^{[80]}^{[81]}
Related codes
This section may contain an excessive number of citations. (March 2021) 
There are a number of binary codes similar to Gray codes, including:
 Datex codes aka Giannini codes (1954), as described by Carl P. Spaulding,^{[8]}^{[82]}^{[83]}^{[84]}^{[85]}^{[7]} use a variant of O'Brien code II.
 Codes used by Varec (ca. 1954),^{[86]}^{[87]}^{[88]}^{[89]} use a variant of O'Brien code I as well as base12 and base16 Gray code variants.
 Lucal code (1959)^{[1]}^{[2]}^{[56]} aka modified reflected binary code (MRB)^{[1]}^{[2]}^{[nb 3]}
 Gillham code (1961/1962),^{[83]}^{[90]}^{[7]}^{[91]}^{[92]} uses a variant of Datex code and O'Brien code II.
 Leslie and Russell code (1964)^{[93]}^{[9]}^{[94]}^{[90]}
 Royal Radar Establishment code^{[90]}
 Hoklas code (1988)^{[95]}^{[96]}^{[97]}
The following binarycoded decimal (BCD) codes are Gray code variants as well:
 Petherick code (1953),^{[18]}^{[98]}^{[99]}^{[100]}^{[54]}^{[96]}^{[nb 4]} also known as Royal Aircraft Establishment (RAE) code.^{[101]}
 O'Brien codes I and II (1955)^{[102]}^{[103]}^{[104]}^{[84]}^{[85]}^{[96]} (An O'Brien typeI code^{[nb 5]} was already described by Frederic A. Foss of IBM^{[105]}^{[106]} and used by Varec in 1954. Later, it was also known as Watts code or Watts reflected decimal (WRD) code and is sometimes ambiguously referred to as reflected binary modified Gray code.^{[107]}^{[19]}^{[20]}^{[108]}^{[109]}^{[110]}^{[111]}^{[112]}^{[113]}^{[nb 1]}^{[nb 3]} An O'Brien typeII code was already used by Datex in 1954.^{[nb 4]})
 Excess3 Gray code (1956)^{[114]} (aka Gray excess3 code,^{[84]}^{[85]}^{[7]} Gray 3excess code, reflex excess3 code, excess Gray code,^{[96]} Gray excess code, 10excess3 Gray code or Gray–Stibitz code), described by Frank P. Turvey Jr. of ITT.^{[114]}
 Tompkins codes I and II (1956)^{[3]}^{[103]}^{[104]}^{[84]}^{[85]}^{[96]}
 Glixon code (1957), sometimes ambiguously also called modified Gray code^{[115]}^{[54]}^{[116]}^{[117]}^{[103]}^{[104]}^{[84]}^{[85]}^{[96]}^{[nb 3]}^{[nb 5]}
Name  Bit  0  1  2  3  4  5  6  7  8  9  Weights^{[nb 7]}  Tracks  Compl.  Cyclic  5s  Comment 
Gray BCD  4  0  0  0  0  0  0  0  0  1  1  0..3  4 (3^{[nb 8]})    (2, 4, 8, 16)    ^{[103]}^{[104]} 
3  0  0  0  0  1  1  1  1  1  1  
2  0  0  1  1  1  1  0  0  0  0  
1  0  1  1  0  0  1  1  0  0  1  
Paul  4  1  0  0  0  0  0  0  0  1  1  1..3  4 (3^{[nb 8]})    2, 10    ^{[118]} 
3  0  0  0  0  1  1  1  1  1  1  
2  0  0  1  1  1  1  0  0  0  0  
1  1  1  1  0  0  1  1  0  0  1  
Glixon  4  0  0  0  0  0  0  0  0  1  1  0..3  4    2, 4, 8, 10  (shifted +1)  ^{[115]}^{[103]}^{[104]}^{[116]}^{[117]}^{[nb 5]} 
3  0  0  0  0  1  1  1  1  1  0  
2  0  0  1  1  1  1  0  0  0  0  
1  0  1  1  0  0  1  1  0  0  0  
Tompkins I  4  0  0  0  0  0  1  1  1  1  1  0..4  2    2, 4, 10  +  ^{[3]}^{[103]}^{[104]} 
3  0  0  0  0  1  1  1  1  1  0  
2  0  0  1  1  1  1  1  0  0  0  
1  0  1  1  0  0  0  1  1  0  0  
O'Brien I (Watts)  4  0  0  0  0  0  1  1  1  1  1  0..3  4  9^{[96]}^{[97]}^{[nb 9]}  2, 4, 10  +  ^{[102]}^{[103]}^{[104]}^{[nb 5]} 
3  0  0  0  0  1  1  0  0  0  0  
2  0  0  1  1  1  1  1  1  0  0  
1  0  1  1  0  0  0  0  1  1  0  
Petherick (RAE)  4  0  0  0  0  0  1  1  1  1  1  1..3  3  9^{[96]}^{[97]}^{[nb 9]}  2, 10  +  ^{[18]}^{[100]}^{[nb 4]} 
3  1  0  0  0  1  1  0  0  0  1  
2  0  0  1  1  1  1  1  1  0  0  
1  1  1  1  0  0  0  0  1  1  1  
O'Brien II  4  0  0  0  0  0  1  1  1  1  1  1..3  3  9^{[84]}^{[96]}^{[97]}^{[nb 9]}  2, 10  +  ^{[102]}^{[103]}^{[104]}^{[nb 4]} 
3  0  0  0  1  1  1  1  0  0  0  
2  0  1  1  1  0  0  1  1  1  0  
1  1  1  0  0  0  0  0  0  1  1  
Susskind  4  0  0  0  0  0  1  1  1  1  1  1..4  3  9^{[nb 9]}  2, 10  +  ^{[5]} 
3  0  0  1  1  1  1  1  1  0  0  
2  0  1  1  1  0  0  1  1  1  0  
1  1  1  1  0  0  0  0  1  1  1  
Klar  4  0  0  0  0  0  1  1  1  1  1  0..4  4 (3^{[nb 8]})  9^{[nb 9]}  2, 10  +  ^{[119]}^{[120]} 
3  0  0  0  1  1  1  1  0  0  0  
2  0  0  1  1  1  1  1  1  0  0  
1  0  1  1  1  0  0  1  1  1  0  
Tompkins II  4  0  0  0  0  0  1  1  1  1  1  1..3  2  9^{[nb 10]}  2, 10  +  ^{[3]}^{[103]}^{[104]} 
3  0  0  1  1  1  1  1  0  0  0  
2  1  1  1  0  0  0  0  0  1  1  
1  0  1  1  1  0  0  1  1  1  0  
Excess3 Gray  4  0  0  0  0  0  1  1  1  1  1  1..4  4  9^{[96]}^{[97]}^{[nb 9]}  2, 10  +  ^{[7]}^{[96]} 
3  0  1  1  1  1  1  1  1  1  0  
2  1  1  1  0  0  0  0  1  1  1  
1  0  0  1  1  0  0  1  1  0  0 
See also
 Linear feedback shift register
 De Bruijn sequence – a Gray code on a larger alphabet than {0,1}.
 Steinhaus–Johnson–Trotter algorithm – an algorithm that generates Gray codes for the factorial number system
 Minimum distance code
 Prouhet–Thue–Morse sequence – related to inverse Gray code
 Ryser formula
 Hilbert curve
Notes
 ^ ^{a} ^{b} ^{c} By applying a simple inversion rule, the Gray code and the O'Brien code I can be translated into the 8421 pure binary code and the 2421 Aiken code, respectively, to ease arithmetic operations.^{[C]}
 ^ Sequence 0, 1, 0, 2, 0, 1, 0, 3, … (sequence A007814 in the OEIS).
 ^ ^{a} ^{b} ^{c} There are several Gray code variants which are called "modified" of some sort: The Glixon code is sometimes called modified Gray code.^{[D]} The Lucal code is also called modified reflected binary code (MRB).^{[E]} The O'Brien code I or Watts code is sometimes referred to as reflected binary modified Gray code.^{[F]}
 ^ ^{a} ^{b} ^{c} ^{d} By interchanging and inverting three bit rows, the O'Brien code II and the Petherick code can be transferred into each other.
 ^ ^{a} ^{b} ^{c} ^{d} By swapping two pairs of bit rows, individually shifting four bit rows and inverting one of them, the Glixon code and the O'Brien code I can be transferred into each other.
 ^ Other unitdistance BCD codes include the nonGray code related 5bit Libaw–Craig and the 121 code.
 ^ Depending on a code's target application, the Hamming weights of a code can be important properties beyond codingtheoretical considerations also for physical reasons. Under some circumstances the allcleared and/or allset states must be omitted (f.e. to avoid nonconductive or shortcircuit conditions), it may be desirable to keep the highest used weight as low as possible (f.e. to reduce power consumption of the reader circuit) or to keep the variance of used weights small (f.e. to reduce acoustic noise or current fluctuations).
 ^ ^{a} ^{b} ^{c} For Gray BCD, Paul and Klar codes, the number of necessary reading tracks can be reduced from 4 to 3 if inversion of one of the middle tracks is acceptable.
 ^ ^{a} ^{b} ^{c} ^{d} ^{e} ^{f} For O'Brien codes I and II and Petherick, Susskind, Klar as well as Excess3 Gray codes, a 9s complement can be derived by inverting the mostsignificant (fourth) binary digit.
 ^ For Tompkins code II, a 9s complement can be derived by inverting the first three digits and swapping the two middle binary digits.
References
 ^ ^{a} ^{b} ^{c} Lucal, Harold M. (December 1959). "Arithmetic Operations for Digital Computers Using a Modified Reflected Binary". IRE Transactions on Electronic Computers. EC8 (4): 449–458. doi:10.1109/TEC.1959.5222057. ISSN 03679950. S2CID 206673385. (10 pages)
 ^ ^{a} ^{b} ^{c} Sellers, Jr., Frederick F.; Hsiao, MuYue; Bearnson, Leroy W. (November 1968). Error Detecting Logic for Digital Computers (1st ed.). New York, USA: McGrawHill Book Company. pp. 152–164. LCCN 6816491. OCLC 439460.
 ^ ^{a} ^{b} ^{c} ^{d} Tompkins, Howard E. (September 1956) [19560716]. "UnitDistance BinaryDecimal Codes for TwoTrack Commutation". IRE Transactions on Electronic Computers. Correspondence. Moore School of Electrical Engineering, University of Pennsylvania, Philadelphia, Pennsylvania, USA. EC5 (3): 139. doi:10.1109/TEC.1956.5219934. ISSN 03679950. Retrieved 20200518. (1 page)
 ^ ^{a} ^{b} Kautz, William H. (June 1958). "UnitDistance ErrorChecking Codes". IRE Transactions on Electronic Computers. EC7 (2): 179–180. doi:10.1109/TEC.1958.5222529. ISSN 03679950. S2CID 26649532. (2 pages)
 ^ ^{a} ^{b} Susskind, Alfred Kriss; Ward, John Erwin (19580328) [1957, 1956]. "III.F. UnitDistance Codes / VI.E.2. Reflected Binary Codes". Written at Cambridge, Massachusetts, USA. In Susskind, Alfred Kriss (ed.). Notes on AnalogDigital Conversion Techniques. Technology Books in Science and Engineering. 1 (3 ed.). New York, USA: Technology Press of the Massachusetts Institute of Technology / John Wiley & Sons, Inc. / Chapman & Hall, Ltd. pp. 310–316 [313–316], 665–660 [660]. (x+416+2 pages) (NB. The contents of the book was originally prepared by staff members of the Servomechanisms Laboraratory, Department of Electrical Engineering, MIT, for Special Summer Programs held in 1956 and 1957. Susskind's "readingtype code" is actually a minor variant of the code shown here with the two most significant bit rows swapped to better illustrate symmetries. Also, by swapping two bit rows and inverting one of them, the code can be transferred into the Petherick code, whereas by swapping and inverting two bit rows, the code can be transferred into the O'Brien code II.)
 ^ ^{a} ^{b} Chinal, Jean P. (January 1973). "3.3. Unit Distance Codes". Written at Paris, France. Design Methods for Digital Systems. Translated by Preston, Alan; Summer, Arthur (1st English ed.). Berlin, Germany: AkademieVerlag / SpringerVerlag. p. 50. doi:10.1007/9783642861871. ISBN 9780387058719. License No. 202100/542/73. Order No. 7617470(6047) ES 19 B 1 / 20 K 3. Retrieved 20200621. (xviii+506 pages) (NB. The French 1967 original book was named "Techniques Booléennes et Calculateurs Arithmétiques", published by Éditions Dunod .)
 ^ ^{a} ^{b} ^{c} ^{d} ^{e} ^{f} Military Handbook: Encoders – Shaft Angle To Digital (PDF). United States Department of Defense. 19910930. MILHDBK231A. Archived (PDF) from the original on 20200725. Retrieved 20200725. (NB. Supersedes MILHDBK231(AS) (19700701).)
 ^ ^{a} ^{b} ^{c} Spaulding, Carl P. (19650112) [19540309]. "Digital coding and translating system" (PDF). Monrovia, California, USA: Datex Corporation. U.S. Patent 3165731A. Serial No. 415058. Archived (PDF) from the original on 20200805. Retrieved 20180121. (28 pages)
 ^ ^{a} ^{b} Russell, A. (August 1964). "Some Binary Codes and a Novel FiveChannel Code". Control (Systems, Instrumentation, Data Processing, Automation, Management, incorporating Automation Progress). Special Features. London, UK: MorganGrampain (Publishers) Limited. 8 (74): 399–404. Retrieved 20200622. (6 pages)
 ^ ^{a} ^{b} ^{c} Stibitz, George Robert (19430112) [19411126]. "Binary counter". New York, USA: Bell Telephone Laboratories, Incorporated. U.S. Patent 2,307,868. Serial No. 420537. Retrieved 20200524. p. 2, right column, rows 43–73:
[…] A clearer idea of the position of the balls after each pulse will be obtained if the set of balls is represented by a number having a similar number of digits, each of which may have one of two arbitrary values, for example 0 and 1. If the upper position is called 0 and the lower position […] 1, then the setting of the counter […] may be read from left to right as 0,100,000. […] Following is a translation of the number of pulses received into this form of binary notation for the first sixteen pulses as received on the first five balls […] Pulse number […] Binary notation […]
[1] (4 pages)  ^ ^{a} ^{b} ^{c} ^{d} ^{e} Winder, C. Farrell (October 1959). "Shaft Angle Encoders Afford High Accuracy" (PDF). Electronic Industries. Chilton Company. 18 (10): 76–80. Archived from the original (PDF) on 20200928. Retrieved 20180114. p. 78:
[…] The type of code wheel most popular in optical encoders contains a cyclic binary code pattern designed to give a cyclic sequence of "onoff" outputs. The cyclic binary code is also known as the cyclic progression code, the reflected binary code, and the Gray code. This code was originated by G. R. Stibitz, of Bell Telephone Laboratories, and was first proposed for pulsecode modulation systems by Frank Gray, also of BTL. Thus the name Gray code. The Gray or cyclic code is used mainly to eliminate the possibility of errors at code transition which could result in gross ambiguities. […]
 ^ ^{a} ^{b} ^{c} ^{d} ^{e} ^{f} ^{g} ^{h} ^{i} Knuth, Donald Ervin (20140912). "Enumeration and Backtracking / Generating all ntuples". The Art of Computer Programming, Volume 4A: Combinatorial Algorithms, Part 1. 4A (1 ed.). AddisonWesley Professional. pp. 442–443. ISBN 9780133488852. ISBN 0133488853. (912 pages)
 ^ ^{a} ^{b} Gray, Frank (19530317) [19471113]. Pulse Code Communication (PDF). New York, USA: Bell Telephone Laboratories, Incorporated. U.S. Patent 2,632,058. Serial No. 785697. Archived (PDF) from the original on 20200805. Retrieved 20200805. (13 pages)
 ^ ^{a} ^{b} Goldberg, David Edward (1989). Genetic Algorithms in Search, Optimization, and Machine Learning (1 ed.). Reading, Massachusetts, USA: AddisonWesley.
 ^ Breckman, Jack (19560131) [19531231]. Encoding Circuit (PDF). Long Branch, New Jersey, USA: US Secretary of the Army. U.S. Patent 2,733,432. Serial No. 401738. Archived (PDF) from the original on 20200805. Retrieved 20200805. (8 pages)
 ^ ^{a} ^{b} Ragland, Earl Albert; Schultheis, Jr., Harry B. (19580211) [19531016]. DirectionSensitive Binary Code Position Control System (PDF). North Hollywood, California, USA: Bendix Aviation Corporation. U.S. Patent 2,823,345. Serial No. 386524. Archived (PDF) from the original on 20200805. Retrieved 20200805. (10 pages)
 ^ Domeshek, Sol; Reiner, Stewart (19580624) [19540108]. Automatic Rectification System (PDF). US Secretary of the Navy. U.S. Patent 2,839,974. Serial No. 403085. Archived (PDF) from the original on 20200805. Retrieved 20200805. (8 pages)
 ^ ^{a} ^{b} ^{c} Petherick, Edward John (October 1953). A Cyclic Progressive Binarycodeddecimal System of Representing Numbers (Technical Note MS15). Farnborough, UK: Royal Aircraft Establishment (RAE). (4 pages) (NB. Sometimes referred to as A CyclicCoded BinaryCodedDecimal System of Representing Numbers.)
 ^ ^{a} ^{b} Evans, David Silvester (1960). Fundamentals of Digital Instrumentation (1 ed.). London, UK: Hilger & Watts Ltd. Retrieved 20200524. (39 pages)
 ^ ^{a} ^{b} Evans, David Silvester (March 1961). "Chapter Three: Direct Reading from Coded Scales". Digital Data: Their derivation and reduction for analysis and process control (1 ed.). London, UK: Hilger & Watts Ltd / Interscience Publishers. pp. 18–23. Retrieved 20200524. p. 20–23:
[…] Decoding. […] To decode C.P.B. or W.R.D. codes, a simple inversion rule can be applied. The readings of the higher tracks determine the way in which the lower tracks are translated. The inversion rule is applied line by line for the C.P.B. and for the W.R.D. it is applied decade by decade or line by line. Starting therefore with the top or slowest changing track of the C.P.B., if the result is odd (1) the next track value has to be inverted, i.e. 0 for 1 and 1 for 0. If, however, the first track is even (0), the second track is left as read, i.e. 0 for 0 and 1 for 1. Again, if the resultant reading of the second track is odd, the third track reading is inverted and so on. When an odd is changed to an even the line below is not inverted and when an even is changed to an odd the line below is inverted. The result of applying this rule to the pattern […] is the pure binary (P.B.) pattern […] where each track or digit can be given a definite numerical value (in this instance 1, 2, 4, 8, etc.). […] Using the linebyline inversion rule on the W.R.D. code produces [a] pattern [of 1, 2, 4, 2 code] where again the digits can be given numerical values and summed decade by decade. The summing of the digits can be very useful, for example, in a highspeed scanning system; but in a parallel decoding system […], it is usual to treat each binary quartet or decade as an entity. In other words, if the first or more significant decade is odd, the second decade is rectified or complemented by inverting the D track and so on, the result being the repeating pattern of [rectified W.R.D. code]. This is an extremely easy thing to achieve since the only change required is the inversion of the meaning of the D track or complementing digit. […]
(8+82 pages) (NB. The author does not mention Gray at all and calls the standard Gray code "Cyclic Permuted Binary Code" (C.P.B.), the book index erroneously lists it as "cyclic pure binary code".)  ^ Newson, P. A. (1965). Tables for the Binary Encoding of Angles (1 ed.). United Kingdom Atomic Energy Authority, Research Group, Atomic Energy Research Establishment, Harwell, UK: H. M. Stationery Office. Retrieved 20200524. (12 pages)
 ^ Heath, F. G. (September 1961). "Pioneers Of Binary Coding". Journal of the Institution of Electrical Engineers. Manchester College of Science and Technology, Faculty of Technology of the University of Manchester, Manchester, UK: Institution of Engineering and Technology (IET). 7 (81): 539–541. doi:10.1049/jiee3.1961.0300. Retrieved 20200622. (3 pages)
 ^ Cattermole, Kenneth W. (1969). Written at Harlow, Essex, UK. Principles of pulse code modulation (1 ed.). London, UK / New York, USA: Iliffe Books Ltd. / American Elsevier Publishing Company, Inc. pp. 245, 434. ISBN 9780444197474. LCCN 7880432. SBN 444197478. p. 245:
[…] There seems to be some confusion about the attributation of this code, because two inventors named Gray have been associated with it. When I first heard the name I took it as referring to Elisha Gray, and Heath testifies to his usage of it. Many people take it as referring to Frank Gray of Bell Telephone Laboratories, who in 1947 first proposed its use in coding tubes: his patent is listed in the bibliography. […]
(2+448+2 pages)  ^ Edwards, Anthony William Fairbank (2004). Cogwheels of the Mind: The Story of Venn Diagrams. Baltimore, Maryland, USA: Johns Hopkins University Press. pp. 48, 50. ISBN 0801874343. ISBN 9780801874345.
 ^ Gros, LucAgathonLouis (1872). Théorie du baguenodier par un clerc de notaire lyonnais (in French) (1 ed.). Lyon, France: Aimé Vingtrinier. Archived from the original on 20201217. Retrieved 20201217. [2](2+16+4 pages and 4 pages foldout) (NB. This booklet was published anonymously, but is known to have been authored by Louis Gros.)
 ^ Lucas, Édouard (November 1883). La tour d'Hanoï : Véritable casse tête annamite  Jeu rapporté du Tonkin par le Professeur N. Claus (de Siam) Mandarin du Collège Li Sou Stian! (in French). Imprimerie Paul Bousrez, Tours. (NB. N. Claus de Siam is an anagram of Lucas d'Amiens, pseudonym of the author Édouard Lucas.)
 ^ de Parville, Henri, ed. (18831227). "La tour d'Hanoï, véritable cassetête annamite, jeu rapporté du Tonkin par le professeur N. Claus (de Siam), mandarin du collège LiSouStian. Un vrai cassetête, en effet, mais intéressant. Nous ne saurions mieux remercier le mandarin de son aimable intention à l'égard d'un profane qu'en signalant la Tour d'Hanoï aux personnes patientes possédées par le démon du jeu". Journal des Débats Politiques et Littéraires (Review). Revue des science (in French) (Matin ed.). Paris, France: 1–2 [2]. ark:/12148/bpt6k462461g. Archived from the original on 20201218. Retrieved 20201218. (1 page)
 ^ Allardice, Robert Edgar; Fraser, Alexander Yule, eds. (February 1883). "La Tour d'Hanoï". Proceedings of the Edinburgh Mathematical Society (in English and French). Edinburgh Mathematical Society. 2 (5): 50–53. doi:10.1017/S0013091500037147. eISSN 14643839. ISSN 00130915. Archived from the original on 20201218. Retrieved 20201218. [3] (4 pages)
 ^ Lucas, Édouard (1979) [1892]. Récréations mathématiques (in French). 3 (Librairie Albert Blanchard reissue ed.). p. 58. (The first edition of this book was published posthumously.)
 ^ ^{a} ^{b} Herter, Felix; Rote, Günter (20181114) [20180809, 201712, 20170809, 20160422]. "Loopless Gray Code Enumeration and the Tower of Bucharest" (PDF). Theoretical Computer Science. Berlin, Germany: Institut für Informatik, Freie Universität Berlin. 748: 40–54. arXiv:1604.06707. doi:10.1016/j.tcs.2017.11.017. ISSN 03043975. S2CID 4014870. doi:10.4230/LIPIcs.FUN.2016.19. Archived (PDF) from the original on 20201216. Retrieved 20201216. [4] (15/18/19/24 pages)
 ^ Gardner, Martin (August 1972). "The curious properties of the Gray code and how it can be used to solve puzzles". Scientific American. Mathematical Games. Vol. 227 no. 2. p. 106. (1 page)
 ^ Zeman, Johann; Fischer, Ferdinand, eds. (1877). "Einige neuere Vorschläge zur mehrfachen Telegraphie: A. Absatzweise vielfache Telegraphie". Dingler's Polytechnisches Journal (in German). Augsburg, Germany: J. G. Cotta'sche Buchhandlung. 226: 499–507. Archived from the original on 20201221. Retrieved 20201221. p. 499:
[…] Der um die Mitte des J[ahres] 1874 patenti[e]rte, ebenfalls dem Highton'schen verwandte Typendrucker des französischen TelegraphenVerwaltungsbeamten Baudot wurde bei seiner 1875 patenti[e]rten Weiterentwicklung in einen fünffachen umgewandelt […]
 ^ Butrica, Andrew J. (19910621). "Baudot, Jean Maurice Emile". In Froehlich, Fritz E.; Kent, Allen; Hall, Carolyn M. (eds.). The Froehlich/Kent Encyclopedia of Telecommunications: Volume 2  Batteries to CodesTelecommunications. 2. Marcel Dekker Inc. / CRC Press. pp. 31–34. ISBN 0824729013. LCCN 903966. ISBN 9780824729011. Retrieved 20201220. p. 31:
[…] A Baudot prototype (4 years in the making) was built in 1876. The transmitter had 5 keys similar to those of a piano. Messages were sent in a special 5element code devised by Baudot […]
 ^ Fischer, Eric N. (20000620). "The Evolution of Character Codes, 1874–1968". ark:/13960/t07x23w8s. Retrieved 20201220.
[…] In 1872, [Baudot] started research toward a telegraph system that would allow multiple operators to transmit simultaneously over a single wire and, as the transmissions were received, would print them in ordinary alphabetic characters on a strip of paper. He received a patent for such a system on June 17, 1874. […] Instead of a variable delay followed by a singleunit pulse, Baudot's system used a uniform six time units to transmit each character. […] his early telegraph probably used the sixunit code […] that he attributes to Davy in an 1877 article. […] in 1876 Baudot redesigned his equipment to use a fiveunit code. Punctuation and digits were still sometimes needed, though, so he adopted from Hughes the use of two special letter space and figure space characters that would cause the printer to shift between cases at the same time as it advanced the paper without printing. The fiveunit code he began using at this time […] was structured to suit his keyboard […], which controlled two units of each character with switches operated by the left hand and the other three units with the right hand. […]
[5][6]  ^ Rothen, Timotheus (18841225). "Le télégraphe imprimeur Baudot". Journal Télégraphique (in French). Berne, Switzerland: Le Bureau International des Administrations Télégraphiques. VIII / #16 (12): 241–253 [249]. eISSN 2725738X. ISSN 22231420. ark:/12148/bpt6k5725454q. Retrieved 20201220. [7]
 ^ Pendry, Henry Walter (1920) [October 1919]. Written at London, UK. The Baudôt Printing Telegraph System (2 ed.). London, Bath, Melbourne, New York: Sir Isaac Pitman and Sons, Ltd. pp. 43–44. LCCN 21005277. OCLC 778309351. OL 6633244M. Retrieved 20201220. (vii+184 pages) (NB. A first edition was published in 1913.)
 ^ ^{a} ^{b} MacMillan, David M. (20100427) [20100425, 20100423]. "Codes that Don't Count  Some Printing Telegraph Codes as Products of their Technologies (With Particular Attention to the Teletypesetter)". lemur.com. Revision 3. Mineral Point, Wisconsin, USA. Archived from the original on 20201218. Retrieved 20201220.
 ^ Written at Lisbon, Portugual. Convention télégraphique internationale de SaintPétersbourg et Règlement et tarifs y annexés, Revision de Lisbonne, 1908 / Extraits de la publication: Documents de la Conférence télégraphique internationale de Lisbonne (in French). Berne, Switzerland: Bureau Internationale de L'Union Télégraphique. 1909 [1908].
 ^ "Chapter IX. Signaux de transmission, Article 35. Signaux de transmission des alphabets télegraphiques internationaux 'nos 1 et 2, signaux d.u code Morse, de l'appareil Hughes et de l'appareil Siemens". Written at Madrid, Spain. Règlement télégraphique annexé à la convention internationale des télécommunications  protocol finale audit règlement  Madrid, 1932 (PDF) (in French). Berne, Switzerland: Bureau Internationale de L'Union Télégraphique. 1933 [1932]. pp. 31–40 [33]. Archived (PDF) from the original on 20201221. Retrieved 20201221. (1+188 pages) [8]
 ^ "Chapter IX. Transmission Signals. Article 35. Transmission Signals of the International Telegraph Alphabets Nos. 1 and 2, Morse Code Signals and Signals of the Hughes and Siemens Instruments.". Telegraph Regulations Annexed To The International Telecommunication Convention  Final Protocol To The Telegraph Regulations  Madrid 1932 (PDF) (in English and French). London, UK: General Post Office / His Majesty's Stationery Office. 1933 [1932]. pp. 32–40 [34]. 431522 / 18693. Archived (PDF) from the original on 20201221. Retrieved 20201221. (1+2*120+26 pages) [9]
 ^ Zemanek, Heinrich "Heinz" Josef (19831201). Otto Schäffler (18381928). Pionier des Telephons, der Telegraphie und der Lochkarte sowie Erbauer der ersten Wiener Telephonzentrale. Blätter für Technikgeschichte (in German and English). 41–43 (1979–1981) (1 ed.). Vienna, Austria: Technisches Museum für Industrie und Gewerbe, Forschungsinstitut für Technikgeschichte / SpringerVerlag. pp. 81–118. ISBN 3211817794. ISSN 00679127. OCLC 952698275. ISBN 9783211817797.
 ^ Zemanek, Heinrich "Heinz" Josef (19760607). "Computer prehistory and history in central Europe". Written at Vienna, Austria. International Workshop on Managing Requirements Knowledge. AFIPS '76: Proceedings of the June 7–10, 1976, national computer conference and exposition June 1976. 1. New York, USA: American Federation of Information Processing Societies, Association for Computing Machinery. pp. 15–20. doi:10.1145/1499799.1499803. ISBN 9781450379175. S2CID 14114959. doi:10.1109/AFIPS.1976.41. Archived from the original on 20201217. Retrieved 20201217. p. 17:
[…] In 1874, Schaeffler invented another printing telegraph, a quadruple system like the Baudot, but mechanically more sophisticated. The Hughes telegraph had two synchronously rotating fingers, one in the sender and one in the receiver. By a pianolike keyboard the operator selected a letter and thereby made contact with the rotating finger in the corresponding direction. Since the receiving finger was in the same direction at this moment, the receiver could print the correct letter. The Baudot and the Schaeffler printing telegraphs use a fivebit binary code. ... Schaeffler's code is a reflected binary code! What F. Gray patented in 1953 for PCM, Schaeffler had applied in his telegraph in 1874, and for a similar reason: reliability. He had contact fingers sensing on five cams consecutively all combinations; the right one triggers printing. If the fingers are to make a minimal number of movements, the solution is the reflected binary code. For Schaeffler, this idea was a minor one. More exactly, the code is described in a letter by the Austrian Post employee, J[ohann] N[epomuk] Teufelhart, inserted there as a footnote and telling that Schaeffler found the code by combining wooden bars with the different combinations until he had the best solution. Another Post employee, Alexander Wilhelm Lambert of Linz, claims to have shown this code to Schaeffler as early as 1872, but this claim is not clear and cannot be checked. […]
(6 pages)  ^ Goodall, William M. (January 1951). "Television by Pulse Code Modulation". Bell System Technical Journal. 30 (1): 33–49. doi:10.1002/j.15387305.1951.tb01365.x. (NB. Presented orally before the I.R.E. National Convention, New York City, March 1949.)
 ^ Karnaugh, Maurice (November 1953) [19530423, 19530317]. "The Map Method for Synthesis of Combinational Logic Circuits" (PDF). Transactions of the American Institute of Electrical Engineers, Part I: Communication and Electronics. 72 (5): 593–599. doi:10.1109/TCE.1953.6371932. Paper 53217. Archived from the original (PDF) on 20170416. Retrieved 20170416. (NB. Also contains a short review by Samuel H. Caldwell.)
 ^ Wakerly, John F. (1994). Digital Design: Principles & Practices. New Jersey, USA: Prentice Hall. pp. 48–49, 222. ISBN 0132114593. ISBN 9780132114592. (NB. The two page sections taken together say that Kmaps are labeled with Gray code. The first section says that they are labeled with a code that changes only one bit between entries and the second section says that such a code is called Gray code.)
 ^ Brown, Frank Markham (2012) [2003, 1990]. "3.9.2 Maps". Boolean Reasoning – The Logic of Boolean Equations (reissue of 2nd ed.). Mineola, New York, USA: Dover Publications, Inc. p. 49. ISBN 9780486427850. p. 49:
[…] Karnaugh's map orders the arguments of the discriminants according to the reflected binary code, also called the Gray code. […]
(xii+291+3 pages) 1st edition  ^ Händler, Wolfgang (1958). Ein Minimisierungsverfahren zur Synthese von Schaltkreisen (Minimisierungsgraphen) (Dissertation) (in German). Potsdam, Germany: Technische Hochschule Darmstadt. D 17. (73 pages+app.) [10]
 ^ Berger, Erich R.; Händler, Wolfgang (1967) [1962]. Steinbuch, Karl W.; Wagner, Siegfried W. (eds.). Taschenbuch der Nachrichtenverarbeitung (in German) (2 ed.). Berlin, Germany: SpringerVerlag OHG. pp. 64, 1034–1035, 1036, 1038. LCCN 6721079. Title No. 1036. p. 64:
[…] Übersichtlich ist die Darstellung nach Händler, die sämtliche Punkte, numeriert nach dem GrayCode […], auf dem Umfeld eines Kreises anordnet. Sie erfordert allerdings sehr viel Platz. […]
[Händler's diagram, where all points, numbered according to the Gray code, are arranged on the circumference of a circle, is easily comprehensible. It needs, however, a lot of space.]  ^ "Informatik Sammlung Erlangen (ISER)" (in German). Erlangen, Germany: FriedrichAlexander Universität. 20120313. Archived from the original on 20170516. Retrieved 20170412.
 ^ "Informatik Sammlung Erlangen (ISER) – Impressum" (in German). Erlangen, Germany: FriedrichAlexander Universität. 20120313. Archived from the original on 20120226. Retrieved 20170415.
 ^ ^{a} ^{b} ^{c} ^{d} ^{e} Bhat, Girish S.; Savage, Carla Diane (1996). "Balanced Gray Codes". Electronic Journal of Combinatorics. 3 (1). doi:10.37236/1249.
 ^ Donohue, Ryan (2003). "Synchronization in Digital Logic Circuits" (PDF). Archived (PDF) from the original on 20180115. Retrieved 20180115.
 ^ Hulst, George D. (19620206) [19571115]. Reflected binary code counter (PDF). Nutley, New Jersey, USA: International Telephone and Telegraph Corporation (ITT). U.S. Patent 3,020,481. Serial No. 696793. Archived (PDF) from the original on 20200806. Retrieved 20200806. (5 pages)
 ^ ^{a} ^{b} ^{c} ^{d} Powell, E. Alexander (June 1968). "Codes particularly useful for analogue to digital conversions". A short note on useful codes for Fluidic Control Circuits (PDF). Cranfield, UK: The College of Aeronautics, Department of Production Engineering. pp. 7, 9. S2CID 215864694. CoA Memo 156. Archived (PDF) from the original on 20201215. Retrieved 20201215. (18 pages) (NB. The paper names the Glixon code modified Gray code and misspells Richard W. Hamming's name.)
 ^ Mehta, Huzefa; Owens, Robert Michael; Irwin, Mary Jane "Janie" (19960322). Some issues in Gray code addressing. Proceedings of the 6th Great Lakes Symposium on VLSI (GLSVLSI 96). IEEE Computer Society. pp. 178–181. doi:10.1109/GLSV.1996.497616. ISBN 9780818675027. ISSN 10661395.
 ^ ^{a} ^{b} Doran, Robert "Bob" William (March 2007). The Gray Code (PDF). CDMTCS Research Report Series. Centre for Discrete Mathematics and Theoretical Computer Science, University of Auckland, New Zealand. CDMTCS304. Archived (PDF) from the original on 20200522. Retrieved 20200523. (25 pages)
 ^ Su, ChingLong; Tsui, ChiYing; Despain, Alvin M. (1994). Low Power Architecture Design and Compilation Techniques for HighPerformance Processors (PDF) (Report). Advanced Computer Architecture Laboratory. ACALTR9401. Archived (PDF) from the original on 20200726. Retrieved 20201217.
 ^ Guo, Hui; Parameswaran, Sri (April–June 2010). "Shifted Gray encoding to reduce instruction memory address bus switching for lowpower embedded systems". Journal of Systems Architecture. 56 (4–6): 180–190. doi:10.1016/j.sysarc.2010.03.003.
 ^ Dietz, Henry Gordon "Hank" (2002). "The Aggregate Magic Algorithms: Gray Code Conversion". The Aggregate. Electrical and Computer Engineering Department, College of Engineering, University of Kentucky. Archived from the original on 20201216. Retrieved 20201216.
 ^ ^{a} ^{b} Guan, DahJyh (1998). "Generalized Gray Codes with Applications". Proceedings of the National Scientific Council, Republic of China, Part A. 22: 841–848. CiteSeerX 10.1.1.119.1344.
 ^ ^{a} ^{b} Suparta, I. Nengah (2005). "A simple proof for the existence of exponentially balanced Gray codes". Electronic Journal of Combinatorics. 12. doi:10.37236/1986.
 ^ ^{a} ^{b} Flahive, Mary Elizabeth; Bose, Bella (2007). "Balancing cyclic Rary Gray codes". Electronic Journal of Combinatorics. 14. doi:10.37236/949.
 ^ Strackx, Raoul; Piessens, Frank (2016). "Ariadne: A Minimal Approach to State Continuity". Usenix Security. 25.
 ^ ^{a} ^{b} Savage, Carla Diane; Winkler, Peter (1995). "Monotone Gray codes and the middle levels problem". Journal of Combinatorial Theory, Series A. 70 (2): 230–248. doi:10.1016/00973165(95)900918. ISSN 00973165.
 ^ Savage, Carla Diane (19970116). "Long cycles in the middle two levels of the Boolean lattice". Ars Combinatoria. North Carolina State University, Raleigh, North Carolina, USA. 35 (A): 97–108. CiteSeerX 10.1.1.39.2249. ISSN 03817032. S2CID 15975960. Archived from the original on 20200513. Retrieved 20200513. (15 pages)
 ^ ^{a} ^{b} Goddyn, Luis (1999). "MATH 343 Applied Discrete Math Supplementary Materials" (PDF). Department of Mathematics, Simon Fraser University. Archived from the original (PDF) on 20150217.
 ^ Sawada, Joseph "Joe"; Wong, Dennis ChiHim (2007). "A Fast Algorithm to generate Beckett–Gray codes". Electronic Notes in Discrete Mathematics. 29: 571–577. doi:10.1016/j.endm.2007.07.091.
 ^ Richards, Richard Kohler (January 1971). "SnakeintheBox Codes". Written at Ames, Iowa, USA. Digital Design. New York, USA: WileyInterscience, John Wiley & Sons, Inc. pp. 206–207. ISBN 0471719455. LCCN 73147235. (12+577+1 pages)
 ^ ^{a} ^{b} NZ 264738, Spedding, Norman Bruce, "A position encoder", published 19941028^{[failed verification]}
 ^ Spedding, Norman Bruce (19941028). "The following is a copy of the provisional patent filed on behalf of Industrial Research Limited on 19941028 – NZ Patent 264738" (PDF). Industrial Research Limited. NZ Patent 264738. Archived (PDF) from the original on 20171029. Retrieved 20180114.
 ^ Hiltgen, Alain P.; Paterson, Kenneth G.; Brandestini, Marco (September 1996). "SingleTrack Gray Codes" (PDF). IEEE Transactions on Information Theory. 42 (5): 1555–1561. doi:10.1109/18.532900. Zbl 857.94007.
 ^ Hiltgen, Alain P.; Paterson, Kenneth G. (September 2001). "SingleTrack Circuit Codes" (PDF). IEEE Transactions on Information Theory. 47 (6): 2587–2595. CiteSeerX 10.1.1.10.8218. doi:10.1109/18.945274. Archived (PDF) from the original on 20180115. Retrieved 20180115.
 ^ Etzion, Tuvi; Schwartz, Moshe (November 1999) [19980517]. "The Structure of SingleTrack Gray Codes" (PDF). IEEE Transactions on Information Theory. IT45 (7): 2383–2396. CiteSeerX 10.1.1.14.8333. doi:10.1109/18.796379. Archived (PDF) from the original on 20180115. Retrieved 20180115. Technical Report CS0937
 ^ Sillke, Torsten (1997) [19930301]. "GrayCodes with few tracks (a question of Marco Brandestini)". Archived from the original on 20171029. Retrieved 20171029.
 ^ Etzion, Tuvi; Paterson, Kenneth G. (May 1996). "Near Optimal SingleTrack Gray Codes" (PDF). IEEE Transactions on Information Theory. IT42 (3): 779–789. CiteSeerX 10.1.1.14.1527. doi:10.1109/18.490544. Archived (PDF) from the original on 20161030. Retrieved 20180408.
 ^ Ruskey, Frank; Weston, Mark (20050618). "A Survey of Venn Diagrams: Symmetric Diagrams". Dynamic Surveys. Electronic Journal of Combinatorics. doi:10.37236/26.
 ^ Alciatore, David G.; Histand, Michael B. (1999). Mechatronics. McGraw–Hill Education – Europe. ISBN 9780071314442.
 ^ Krishna (20080511). "Gray code for QAM". Archived from the original on 20171029. Retrieved 20171029.
 ^ Strang, Thomas; Dammann, Armin; Röckl, Matthias; Plass, Simon (October 2009). Using Gray codes as Location Identifiers (PDF). 6. GI/ITG KuVS Fachgespräch Ortsbezogene Anwendungen und Dienste (in English and German). Oberpfaffenhofen, Germany: Institute of Communications and Navigation, German Aerospace Center (DLR). CiteSeerX 10.1.1.398.9164. Archived (PDF) from the original on 20150501. Retrieved 20201216. Lay summary (PDF). (5/8 pages) [11]
 ^ Greferath, Marcus (2009). "An Introduction to RingLinear Coding Theory". In Sala, Massimiliano; Mora, Teo; Perret, Ludovic; Sakata, Shojiro; Traverso, Carlo (eds.). Gröbner Bases, Coding, and Cryptography. Springer Science & Business Media. p. 220. ISBN 9783540938064.
 ^ Solé, Patrick (20160417). Hazewinkel, Michiel (ed.). Kerdock and Preparata codes. Encyclopedia of Mathematics. Springer Science+Business Media. ISBN 1402006098. ISBN 9781402006098. Archived from the original on 20171029. Retrieved 20171029.
 ^ Spaulding, Carl P. (19650712). How to Use Shaft Encoders. Monrovia, California, USA: Datex Corporation. (85 pages)
 ^ ^{a} ^{b} Wheeler, Edwin L. (19691230) [19680405]. Analog to digital encoder (PDF). New York, USA: Conrac Corporation. U.S. Patent 3487460A. Serial No. 719026 (397812). Archived (PDF) from the original on 20200805. Retrieved 20180121. p. 5, left column 9, rows 15–22:
[…] The MOAGILLHAM code is essentially the combination of the Gray code discussed thereinabove and the well known Datex code; the Datex code is disclosed in U.S. Patent 3,165,731. The arrangement is such that the Datex code defines the bits for the units count of the encoder and the Gray code defines the bits for each of the higher order decades, the tens, hundreds, etc. […]
(11 pages)  ^ ^{a} ^{b} ^{c} ^{d} ^{e} ^{f} Dokter, Folkert; Steinhauer, Jürgen (19730618). "2.4. Coding numbers in the binary system". Digital Electronics. Philips Technical Library (PTL) / Macmillan Education (Reprint of 1st English ed.). Eindhoven, Netherlands: The Macmillan Press Ltd. / N. V. Philips' Gloeilampenfabrieken. pp. 32, 39, 50–53. doi:10.1007/9781349014170. ISBN 9781349014194. SBN 333133609. Retrieved 20200511. p. 53:
[…] The Datex code […] uses the O'Brien code II within each decade, and reflected decimal numbers for the decimal transitions. For further processing, code conversion to the natural decimal notation is necessary. Since the O'Brien II code forms a 9s complement, this does not give rise to particular difficulties: whenever the code word for the tens represents an odd number, the code words for the decimal units are given as the 9s complements by inversion of the fourth binary digit. […]
(270 pages)  ^ ^{a} ^{b} ^{c} ^{d} ^{e} Dokter, Folkert; Steinhauer, Jürgen (1975) [1969]. "2.4.4.6. Einschrittige Kodes". Digitale Elektronik in der Meßtechnik und Datenverarbeitung: Theoretische Grundlagen und Schaltungstechnik. Philips Fachbücher (in German). I (improved and extended 5th ed.). Hamburg, Germany: Deutsche Philips GmbH. pp. 41, 48, 51, 58, 60–61. ISBN 3871452726. (xii+327+3 pages)
 ^ "…accurate liquid level metering – at ANY DISTANCE!". Petroleum Refiner (Advertisement). Gulf Publishing Company. 33 (9): 368. September 1954. ISSN 00966517. p. 368:
[…] The complete dispatching operation, gauging, and remote control is integrated into one single unitized system when a "Varec" Pulse Code Telemetering System is installed. […]
 ^ Bishup, Bernard W.; Repeta, Anthony A.; Giarrizzo, Frank C. (19680813) [19630403]. "Telemetering and supervisory control system having normally continuous telemetering signals". Leeds and Northrup Co. US3397386A. [12]
 ^ "Encoder Pulse Format". Installation and Operations Manual for the Model 1900 Micro 4Wire Transmitter (PDF). Cypress, California, USA: Whessoe Varec, Inc. January 1993 [19910701]. pp. 044–048. 3308461. Archived (PDF) from the original on 20200516. Retrieved 20200516. (38 pages) (NB. Position 5 for "Inches" on page 048 should read "0111" rather than "1111".)
 ^ "2.2.3.3 MSP Level Data Format". Varec Model 1900 – Micro 4Wire Transmitter (BSAP to Mark / Space Protocol (MSP)) – Application Notes (PDF). Emerson Electric. pp. 11–14. Archived (PDF) from the original on 20200516. Retrieved 20200516. (vi+33 pages)
 ^ ^{a} ^{b} ^{c} Wightman, Eric Jeffrey (1972). "Chapter 6. Displacement measurement". Instrumentation in Process Control (1 ed.). London, UK: Butterworth & Co (Publishers) Ltd. pp. 122–123. ISBN 0408702931. ISBN 1483163350, 9781483163352. p. 122–123:
[…] Other forms of code are also well known. Among these are the Royal Radar Establishment code; The Excess Three decimal code; Gillham code which is recommended by ICAO for automatic height transmission for air traffic control purposes; the Petherick code, and the Leslie and Russell code of the National Engineering Laboratory. Each has its particular merits and they are offered as options by various encoder manufacturers. […]
(12+367+5 pages)  ^ Phillips, Darryl (20120726) [1998]. "Altitude – MODEC ASCII". AirSport Avionics. Archived from the original on 20120726.
 ^ Stewart, K. (20101203). "Aviation Gray Code: Gillham Code Explained". Custom Computer Services (CCS). Archived from the original on 20180116. Retrieved 20180114.
 ^ Leslie, William "Bill" H. P.; Russell, A. (1964). A cyclic progressive decimal code for simple translation to decimal and analogue outputs (Report). East Kilbride, Glasgow, UK: National Engineering Laboratory. NEL Report 129. (17 pages)
 ^ Leslie, William "Bill" H. P. (1974). "The work on NC at NEL". In Koenigsberger, Franz; Tobias, Stephen Albert (eds.). Proceedings of the Fourteenth International Machine Tool Design and Research Conference, 12–14 September 1973. The Macmillan Press Ltd. pp. 215–224 [215, 217]. ISBN 9781349019212. LCCN 7316545. SBN 333149130. ISBN 1349019216.
 ^ Hoklas, Archibald (19890906) [19880429]. "Abtastvorrichtung zur digitalen Weg oder Winkelmessung" (PDF) (in German). VEB Schiffselektronik Johannes Warnke . GDR Patent DD271603A1. WP H 03 M / 315 194 8. Archived from the original (PDF) on 20180118. Retrieved 20180118 – via DEPATIS . [13] [14]
 ^ ^{a} ^{b} ^{c} ^{d} ^{e} ^{f} ^{g} ^{h} ^{i} ^{j} ^{k} Hoklas, Archibald (2005). "Gray code – Unit distance code". Archived from the original on 20180115. Retrieved 20180115.
 ^ ^{a} ^{b} ^{c} ^{d} ^{e} Hoklas, Archibald (2005). "GrayKode – Einschrittiger Abtastkode" (in German). Archived from the original on 20180115. Retrieved 20180115.
 ^ Petherick, Edward John; Hopkins, A. J. (1958). Some Recently Developed Digital Devices for Encoding the Rotations of Shafts (Technical Note MS21). Farnborough, UK: Royal Aircraft Establishment (RAE).
 ^ "Digitizer als AnalogDigitalWandler in der Steuer, Meß und Regeltechnik" (PDF). Technische Mitteilungen. Relais, elektronische Geräte, Steuerungen (in German). No. 13. CologneNiehl, Germany: Franz Baumgartner (FraBa). May 1963. pp. 1–2. Archived from the original (PDF) on 20200521. Retrieved 20200521. pp. 1–2:
[…] Die Firma Harrison Reproduction Equipment, Farnborough/England […] hat in jahrelanger Entwicklung in Zusammenarbeit mit der Britischen Luftwaffe und britischen Industriebetrieben den mechanischen Digitizer […] zu einer technischen Reife gebracht, die fast allen Anforderungen […] genügt. […] Um bei der dezimalen Entschlüsselung des verwendeten Binärcodes zu eindeutigen und bei der Übergabe von einer Dezimalstelle zur anderen in der Reihenfolge immer richtigen Ergebnissen zu kommen, wurde ein spezieller Code entwickelt, der jede Möglichkeit einer Fehlaussage durch sein Prinzip ausschließt und der außerdem durch seinen Aufbau eine relativ einfache Entschlüsselung erlaubt. Der Code basiert auf dem PetherickCode. […]
(4 pages)  ^ ^{a} ^{b} Charnley, C. J.; Bidgood, R. E.; Boardman, G. E. T. (October 1965). "The Design of a Pneumatic Position Encoder" (PDF). IFAC Proceedings Volumes. The College of Aeronautics, Cranfield, Bedford, England. 2 (3): 75–88. doi:10.1016/S14746670(17)689559. Chapter 1.5. Retrieved 20180114.
 ^ Hollingdale, Stuart H. (19580919). "Session 14. Data Processing". Applications of Computers. Atlas – Application of Computers, University of Nottingham 15–19 September 1958 (Conference paper). Archived from the original on 20200525. Retrieved 20200525.
 ^ ^{a} ^{b} ^{c} O'Brien, Joseph A. (May 1956) [19551115, 19550623]. "Cyclic Decimal Codes for Analogue to Digital Converters". Transactions of the American Institute of Electrical Engineers, Part I: Communication and Electronics. Bell Telephone Laboratories, Whippany, New Jersey, USA. 75 (2): 120–122. doi:10.1109/TCE.1956.6372498. ISSN 00972452. S2CID 51657314. Paper 5621. Retrieved 20200518. (3 pages) (NB. This paper was prepared for presentation at the AIEE Winter General Meeting, New York, USA, 19560130 to 19560203.)
 ^ ^{a} ^{b} ^{c} ^{d} ^{e} ^{f} ^{g} ^{h} ^{i} Steinbuch, Karl W., ed. (1962). Written at Karlsruhe, Germany. Taschenbuch der Nachrichtenverarbeitung (in German) (1 ed.). Berlin / Göttingen / New York: SpringerVerlag OHG. pp. 71–74, 97, 761–764, 770, 1080–1081. LCCN 6214511.
 ^ ^{a} ^{b} ^{c} ^{d} ^{e} ^{f} ^{g} ^{h} ^{i} Steinbuch, Karl W.; Weber, Wolfgang; Heinemann, Traute, eds. (1974) [1967]. Taschenbuch der Informatik – Band II – Struktur und Programmierung von EDVSystemen. Taschenbuch der Nachrichtenverarbeitung (in German). 2 (3 ed.). Berlin, Germany: Springer Verlag. pp. 98–100. ISBN 3540062416. LCCN 7380607. ISBN 9783540062417.
 ^ Foss, Frederic A. (19601227) [19541217]. "Control Systems" (PDF). International Business Machines Corp. Fig. 7, Fig. 8, Fig. 11. U.S. Patent 2966670A. Serial No. 475945. Archived (PDF) from the original on 20200621. Retrieved 20200805. (14 pages) (NB. The author called his code 2*421 (+9±7±3±1) reflected decimal code.)
 ^ Foss, Frederic A. (December 1954). "The Use of a Reflected Code in Digital Control Systems". IRE Transactions on Electronic Computers. EC3 (4): 1–6. doi:10.1109/IREPGELC.1954.6499244. ISSN 21681740. (6 pages)
 ^ Evans, David Silvester (1958). "[unknown]". Transactions. Institute of Measurement and Control. 10–12: 87. Cite uses generic title (help) (NB. The Watts code was called W.R.D. code or Watts Reflected Decimal to distinguish it from other codes used at Hilger & Watts Ltd..)
 ^ Benjamin, P. W.; Nicholls, G. S. (1963). "3.2.2 Electromechanical Digitizers". Measurement of Neutron Spectra by SemiAutomatic Scanning of Recoil Protons in Photographic Emulsions. United Kingdom Atomic Energy Authority, Atomic Weapons Research Establishment, UK: U.S. Department of Energy. pp. 8–10, 19. AWRE Report No. NR 5/63. [15] (23 pages)
 ^ Klinkowski, James J. (19670314) [19640323]. "Electronic Diode Matrix Decoder Circuits" (PDF). Detroit, Michigan, USA: Burroughs Corporation. U.S. Patent 3309695A. Serial No. 353845. Archived (PDF) from the original on 20200523. Retrieved 20200523. (5 pages) [16]
 ^ Klinkowski, James J. (19700331) [19661222]. "Binarycoded decimal signal converter" (PDF). Detroit, Michigan, USA: Burroughs Corporation. U.S. Patent 3504363A. Serial No. 603926. Archived (PDF) from the original on 20200523. Retrieved 20200523. (7 pages)
 ^ "[unknown]". Electrical Design News. Rogers Publishing Company. 12. 1967. ISSN 00127515. Cite uses generic title (help) [17][18]
 ^ TóthZentai, Györgyi (19791005). "Some Problems Of Angular Rotational Digital Converters". Periodica Polytechnica Electrical Engineering. Department of Electronics Technology, Technical University, Budapest, Hungary. 23 (3–4): 265–270 [266]. Retrieved 20200523. [19] (6 pages) (NB. Shows a 6digit Watts code.)
 ^ Savard, John J. G. (2018) [2006]. "Decimal Representations". quadibloc. Archived from the original on 20180716. Retrieved 20180716.
 ^ ^{a} ^{b} Turvey, Jr., Frank P. (19580729) [19560517]. "PulseCount Coder" (PDF). Nutley, New Jersey, USA: International Telephone and Telegraph Corporation. U.S. Patent 2845617A. Serial No. 585494. Archived (PDF) from the original on 20200523. Retrieved 20200523. (5 pages)
 ^ ^{a} ^{b} Glixon, Harry Robert (March 1957). "Can You Take Advantage of the Cyclic BinaryDecimal Code?". Control Engineering. Technical Publishing Company, a division of DunDonnelley Publishing Corporation, Dun & Bradstreet Corp. 4 (3): 87–91. ISSN 00108049. (5 pages)
 ^ ^{a} ^{b} Borucki, Lorenz; Dittmann, Joachim (1971) [July 1970, 1966, Autumn 1965]. "2.3 Gebräuchliche Codes in der digitalen Meßtechnik". Written at Krefeld / Karlsruhe, Germany. Digitale Meßtechnik: Eine Einführung (in German) (2 ed.). Berlin / Heidelberg, Germany: SpringerVerlag. pp. 10–23 [12–14]. doi:10.1007/9783642805608. ISBN 3540050582. LCCN 75131547. ISBN 9783642805615. (viii+252 pages) 1st edition (NB. Like Kämmerer, the authors describe a 6bit 20cyclic Glixon code.)
 ^ ^{a} ^{b} Kämmerer, Wilhelm (May 1969). "II.15. Struktur: Informationsdarstellung im Automaten". Written at Jena, Germany. In Frühauf, Hans; Kämmerer, Wilhelm; Schröder, Kurz; Winkler, Helmut (eds.). Digitale Automaten – Theorie, Struktur, Technik, Programmieren. Elektronisches Rechnen und Regeln (in German). 5 (1 ed.). Berlin, Germany: AkademieVerlag GmbH. p. 173. License no. 202100/416/69. Order no. 4666 ES 20 K 3. (NB. A second edition 1973 exists as well. Like Borucki and Dittmann, but without naming it Glixon code, the author creates a 20cyclic tetradic code from Glixon code and a Glixon code variant with inverted highorder bit.)
 ^ Paul, Matthias R. (19950810) [1994]. "Unterbrechungsfreier Schleifencode" [Continuous loop code]. 1.02 (in German). Retrieved 20080211. (NB. The author called this code Schleifencode (English: "loop code"). It differs from Gray BCD code only in the encoding of state 0 to make it a cyclic unitdistance code for fullcircle rotatory applications. Avoiding the allzero code pattern allows for loop selftesting and to use the data lines for uninterrupted power distribution.)
 ^ Klar, Rainer (19700201). Digitale Rechenautomaten – Eine Einführung [Digital Computers – An Introduction]. Sammlung Göschen (in German). 1241/1241a (1 ed.). Berlin, Germany: Walter de Gruyter & Co. / G. J. Göschen'sche Verlagsbuchhandlung . p. 17. ISBN 3110831600. ISBN 9783110831603. ArchivNr. 7990709. Archived from the original on 20200601. Retrieved 20200413. (205 pages) (NB. A 2019 reprint of the first edition is available under ISBN 3110027933, 9783110027938. A reworked and expanded 4th edition exists as well.)
 ^ Klar, Rainer (1989) [19881001]. Digitale Rechenautomaten – Eine Einführung in die Struktur von Computerhardware [Digital Computers – An Introduction into the structure of computer hardware]. Sammlung Göschen (in German). 2050 (4th reworked ed.). Berlin, Germany: Walter de Gruyter & Co. p. 28. ISBN 3110117002. ISBN 9783110117004. (320 pages) (NB. The author called this code Einheitsabstandscode (English: "unitdistance code"). By swapping two bit rows and inverting one of them, it can be transferred into the O'Brien code II, whereas by swapping and inverting two bit rows, it can be transferred into the Petherick code.)
Further reading
 Richards, Richard Kohler (1955). Arithmetic Operations in Digital Computers (5 ed.). New York, USA: D. Van Nostrand Co., Inc.
 Richards, Richard Kohler (1967). Electronic Digital Components and Circuits. D. Van Nostrand Co., Inc. pp. 490, 500–504, 510–511.
 Black, Paul E. (20040225). "Gray code". NIST.
 Press, William H.; Teukolsky, Saul A.; Vetterling, William T.; Flannery, Brian P. (2007). "Section 22.3. Gray Codes". Numerical Recipes: The Art of Scientific Computing (3rd ed.). New York, USA: Cambridge University Press. ISBN 9780521880688.
 Savage, Carla Diane (1997). "A Survey of Combinatorial Gray Codes". SIAM Review. Society for Industrial and Applied Mathematics (SIAM). 39 (4): 605–629. CiteSeerX 10.1.1.39.1924. doi:10.1137/S0036144595295272. JSTOR 2132693.
 Wilf, Herbert Saul (1989). "Chapters 1–3". Combinatorial algorithms: An update. Society for Industrial and Applied Mathematics (SIAM). ISBN 0898712319. ISBN 9780898712315.
 Dewar, Megan; Stevens, Brett (20120829). Ordering Block Designs – Gray Codes, Universal Cycles and Configuration. CMS Books in Mathematics (1 ed.). New York, USA: Springer Science+Business Media. doi:10.1007/9781461443254. ISBN 9781461443247. ISSN 16135237. ISBN 1461443245.
 Maxfield, Clive "Max" (20121001) [20110528]. "Gray Code Fundamentals". Design HowTo. EETimes. Part 1. Archived from the original on 20171030. Retrieved 20171030. Part 2 Part 3
 Warren, Jr., Henry S. (2013). "Chapter 13: Gray Code". Hacker's Delight (2 ed.). Addison Wesley – Pearson Education, Inc. pp. 311–317. ISBN 9780321842688. (7 pages)
 Zinovik, Igor; Kroening, Daniel; Chebiryak, Yury (20080321). "Computing Binary Combinatorial Gray Codes Via Exhaustive Search With SAT Solvers". IEEE Transactions on Information Theory. IEEE. 54 (4): 1819–1823. doi:10.1109/TIT.2008.917695. hdl:20.500.11850/11304. (5 pages)
 O'Brien, Joseph A. (June 1957). "UnitDistance BinaryDecimal Code Translators". IRE Transactions on Electronic Computers. EC6 (2): 122–123. doi:10.1109/TEC.1957.5221585. ISSN 03679950. Retrieved 20200525. (2 pages)
 Barr, K. G. (March 1981). "A decimal Gray code – Easily converted for shaft position coding" (PDF). Wireless World. Vol. 87 no. 1542. Faculty of Natural Sciences, University of the West Indies. pp. 86–87. Archived (PDF) from the original on 20200728. Retrieved 20200728.
External links
 "Gray Code" demonstration by Michael Schreiber, Wolfram Demonstrations Project (with Mathematica implementation). 2007.
 NIST Dictionary of Algorithms and Data Structures: Gray code.
 Hitch Hiker's Guide to Evolutionary Computation, Q21: What are Gray codes, and why are they used?, including C code to convert between binary and BRGC.
 Dragos A. Harabor uses Gray codes in a 3D digitizer.
 Singletrack gray codes, binary chain codes (Lancaster 1994), and linear feedback shift registers are all useful in finding one's absolute position on a singletrack rotary encoder (or other position sensor).
 AMS Column: Gray codes
 Optical Encoder Wheel Generator
 ProtoTalk.net – Understanding Quadrature Encoding – Covers quadrature encoding in more detail with a focus on robotic applications