Skip to main content
3 of 5
added 5 characters in body
Alapan Das
  • 1.8k
  • 1
  • 7
  • 16

To big to comment: If we take the sequence of Gray code numbers to be $\{ g(m) \}_{m=0}^{\infty}$ then the $m$-th Odious number $O(m)$ ($O(0)=1,O(1)=2...$) is the $g(m)$-th number of in the sequence of $g(2k+1), k=0,1,2,...,$

Hence, $O(m)=g(2g(m)+1)$.

A formula for $m$-th Gray number is $$g(m)=\sum_{k=0} \sigma_i(m)2^{k-1}$$ where $\sigma_i(m)=\lfloor{\frac{|r_i(m)|}{2^k}}\rfloor$.

And, $r_i(m)=m-(\lfloor{\frac{m}{2^k}}\rfloor -(-1)^{\lfloor{\frac{m}{2^k}}\rfloor})2^k$.

Alapan Das
  • 1.8k
  • 1
  • 7
  • 16