%I #37 May 11 2021 09:02:25
%S 0,5,6,45,54,365,438,2925,3510,23405,28086,187245,224694,1497965,
%T 1797558,11983725,14380470,95869805,115043766,766958445,920350134,
%U 6135667565,7362801078,49085340525,58902408630,392682724205,471219269046
%N Numbers k such that ror(k) XOR rol(k) = k, where ror(x)=A038572(x) is x rotated one binary place to the right, rol(x)=A006257(x) is x rotated one binary place to the left, and XOR is the binary exclusive-or operator.
%F Conjectures from _Colin Barker_, May 22 2016: (Start)
%F a(n) = (-11+(-1)^n+2^(-1/2+(3*n)/2)*(3-3*(-1)^n+5*sqrt(2)+5*(-1)^n*sqrt(2)))/14.
%F a(n) = 5*(2^(3*n/2)-1)/7 for n even.
%F a(n) = 3*(2^((3*n)/2-1/2)-2)/7 for n odd.
%F a(n) = 9*a(n-2)-8*a(n-4) for n>4.
%F G.f.: x^2*(5+6*x) / ((1-x)*(1+x)*(1-8*x^2)).
%F (End)
%t ok[n_] := Block[{x = IntegerDigits[n, 2]}, x == BitXor @@@ Transpose@ {RotateLeft@ x, RotateRight@ x}]; Select[ Range[0, 10^5], ok] (* _Giovanni Resta_, May 14 2016 *)
%t ok[n_] := Block[{x = IntegerDigits[n, 2]}, x == BitXor @@@ Transpose[ {RotateLeft[x], RotateRight[x]}]]; Select[LinearRecurrence[{0, 9, 0, -8}, {0, 5, 6, 45}, 100], ok] (* _Jean-François Alcover_, May 22 2016, after _Giovanni Resta_ *)
%o (Python)
%o def ROR(n): # returns A038572(n)
%o BL = len(bin(n))-2
%o return (n>>1) + ((n&1) << (BL-1))
%o def ROL(n): # returns A006257(n) for n>0
%o BL = len(bin(n))-2
%o return (n*2) - (1<<BL) + 1
%o print('0', end=',')
%o for n in range(1,100000):
%o if ROR(n) ^ ROL(n) == n: print(n, end=',')
%Y Cf. A006257, A038572, A088163, A125836 (bisection?), A125837 (bisection?).
%Y Cf. A020988 (numbers k such that ror(k) + rol(k) = k).
%K nonn,base
%O 1,2
%A _Alex Ratushnyak_, May 13 2016
%E a(19)-a(27) from _Giovanni Resta_, May 14 2016