A281378 Palindromic numbers which are also palindromic in their binary reflected Gray code representation.
0, 1, 2, 5, 6, 66, 77, 626, 5005, 7777, 22122, 64446, 87978, 399993, 1287821, 5614165, 5679765, 6407046, 6865686, 7107017, 8349438, 8547458, 282777282, 1220330221, 43474247434, 43833533834, 64630703646, 68622322686, 73855855837, 1249451549421, 2468208028642
Offset: 1
Examples
626 is in the sequence because binary reflected Gray code for 626 is '1101001011' and both 626 and '1101001011' are palindromics.
Links
- Chai Wah Wu, Table of n, a(n) for n = 1..47
Programs
-
Mathematica
Select[Range[10^7], And[Reverse@ # == # &@ IntegerDigits@ #, Reverse@ # == # &@ Abs[Prepend[Most@ #, 0] - #] &@ IntegerDigits[#, 2]] &] (* Michael De Vlieger, Jan 21 2017 *)
-
PARI
lista(nn) = {my(v, w); for(k=0, nn, if((w=digits(k))==Vecrev(w) && (v=binary(bitxor(k, k>>1)))==Vecrev(v), print1(k, ", "))); } \\ Jinyuan Wang, Mar 01 2020
-
Python
def G(n): return bin(n^(n//2))[2:] i=1 j=1 while j<=23: if i==int(str(i)[::-1]) and G(i)==G(i)[::-1]: print(str(j)+" "+str(i)) j+=1 i+=1
Extensions
0 and more terms added by Chai Wah Wu, Jan 23 2017