Can you count from 0 to 15 by flipping only one switch at a time?
Using 4 switches to represent the numbers 0 through 15 in ordinary binary, counting upward sometimes flips several switches at once — going from 0111 to 1000 flips all four. Is there a different ordering of all 16 combinations where every step changes exactly one switch?
Reveal the answer
Yes — it's called a Gray code, patented by Frank Gray at Bell Labs in 1947. Each value is generated by reflecting and prefixing the sequence before it, so consecutive values always differ by exactly one bit. It's used in rotary encoders and old telegraph systems to prevent false in-between readings as a dial or wheel turns.
— Frank Gray, Pulse Code Communication — U.S. Patent 2,632,058, filed 1947, granted 1953