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:
- Computer $\sigma(a_{n-1}a_{n-2}...a_0)=a_{n-1}+a_{n-2}+...+a_0.$
- If $\sigma(a_{n-1}a_{n-2}...a_0)$ is even, change $a_0$ from $0$ to $1$ or $1$ to $0$.
- 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.
Graycode word111111111corresponds to binary101010101.The binary successor is
101010110which corresponds to your resultGraycode word111111101