Inverse Gray code

3 · John Cook · Sept. 8, 2020, 11:21 p.m.
The previous post looked at Gray code, a way of encoding digits so that the encodings of consecutive integers differ in only bit. This post will look at how to compute the inverse of Gray code. The Gray code of a non-negative integer n is given by def gray(n): return n ^ (n >> 1) […] The post Inverse Gray code first appeared on John D. Cook....