OFFSET
1,2
FORMULA
Conjectures from Colin Barker, May 22 2016: (Start)
a(n) = (-11 + (-1)^n + 2^(-1/2 + (3*n)/2)*(3 - 3*(-1)^n + 5*sqrt(2) + 5*(-1)^n*sqrt(2)))/14.
a(n) = 5*(2^(3*n/2) - 1)/7 for n even.
a(n) = 3*(2^(3*n/2 - 1/2) - 2)/7 for n odd.
a(n) = 9*a(n-2) - 8*a(n-4) for n > 4.
G.f.: x^2*(5 + 6*x) / ((1 - x)*(1 + x)*(1 - 8*x^2)). (End)
MATHEMATICA
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 *)
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 *)
PROG
(Python)
def ROR(n): # returns A038572(n)
BL = len(bin(n))-2
return (n>>1) + ((n&1) << (BL-1))
def ROL(n): # returns A006257(n) for n>0
BL = len(bin(n))-2
return (n*2) - (1<<BL) + 1
print('0', end=', ')
for n in range(1, 100000):
if ROR(n) ^ ROL(n) == n: print(n, end=', ')
(PARI) select( {is_A273050(n)=bitxor(A038572(n), A006257(n))==n}, [0..10^5]) \\ M. F. Hasler, Sep 26 2025
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Alex Ratushnyak, May 13 2016
EXTENSIONS
a(19)-a(27) from Giovanni Resta, May 14 2016
STATUS
approved
