A281379 Numbers which are palindromic in their binary reflected Gray code representation.
0, 1, 2, 5, 6, 10, 14, 18, 21, 25, 30, 34, 42, 54, 62, 66, 77, 85, 90, 102, 105, 113, 126, 130, 146, 170, 186, 198, 214, 238, 254, 258, 285, 301, 306, 330, 341, 357, 378, 390, 409, 425, 438, 462, 465, 481, 510, 514, 546, 594, 626, 650, 682, 730, 762, 774, 806, 854, 886, 910, 942
Offset: 1
Examples
34 is in the sequence because the binary reflected Gray code representation of 34 is '110011', which is palindromic.
Links
- Indranil Ghosh, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
Select[Range[0, 10^3], Reverse@ # == # &@ Abs[Prepend[Most@ #, 0] - #] &@ IntegerDigits[#, 2] &] (* Michael De Vlieger, Jan 21 2017 *)
-
Python
def G(n): return bin(n^(n//2))[2:] i=0 j=1 while j<=10000: if G(i)==G(i)[::-1]: print(str(j)+" "+str(i)) j+=1 i+=1
Comments