Problem: Determine the immediate successors of the following 9-tuple in the reflected Gray Code of order 9. $$111111111.$$

My Attempt: I am using the following algorithm to solve this problem:

Begin with the $n$ tuple $a_{n-1}a_{n-2}...a_0=00...0.$

While the $n-$ tuple $a_{n-1}a_{n-2}...a_0\neq 10...0,$ do the following:

  1. Computer $\sigma(a_{n-1}a_{n-2}...a_0)=a_{n-1}+a_{n-2}+...+a_0.$
  2. If $\sigma(a_{n-1}a_{n-2}...a_0)$ is even, change $a_0$ from $0$ to $1$ or $1$ to $0$.
  3. Else, determine $j$ such that $a_j=1$ and $a_i=0$ for all $i$ with $j>i$ and then change $a_{j+1}$ from $0$ to $1$ or $1$ to $0$.

We note that in step $(3)$ we may have $j=0$, that is, $a_0=1;$ in this case there is no $i$ with $i<j$, and we change $a_1$ as instructed in step $(3)$.

Using this information I computed $\sigma(111111111)=9$, which is odd. But since there is no $i$ with $i<j$, $a_1=0$ and thus the successor gray code is $111111101.$ I want to know whether this solution is correct or not.


1 Answer 1


Gray code word 111111111 corresponds to binary 101010101.

The binary successor is 101010110 which corresponds to your result Gray code word 111111101


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .