title: How to find if two numbers are consecutive numbers in gray code sequence
body: <p>I am trying to come up with a solution to the problem that given two numbers, find if they are the consecutive numbers in the gray code sequence i.e., if they are gray code neighbors assuming that the gray code sequence is not mentioned.</p>
  
  <p>I searched on various forums but couldn't get the right answer.  It would be great if you can provide a solution for this.</p>
  
  <p>My attempt to the problem - Convert two integers to binary and add the digits in both the numbers separately and find the difference between the sum of the digits in two numbers. If the difference is one then they are gray code neighbors. </p>
  
  <p>But I feel this wont work for all cases. Any help is highly appreciated. Thanks a lot in advance!!!</p>