login
Numbers representable as ror(k)+rol(k), where ror(k)=A038572(k) is k rotated one binary place to the right, rol(k)=A006257(k) is k rotated one binary place to the left.
1

%I #10 May 09 2021 19:21:05

%S 0,2,3,5,6,8,9,10,14,15,17,19,20,22,24,25,27,29,30,32,33,34,37,38,39,

%T 42,43,44,47,48,51,52,53,56,57,58,61,62,63,65,66,67,68,70,71,72,73,75,

%U 76,77,78,80,81,82,83,85,86,87,88,90,91,92,93,95,96,98

%N Numbers representable as ror(k)+rol(k), where ror(k)=A038572(k) is k rotated one binary place to the right, rol(k)=A006257(k) is k rotated one binary place to the left.

%t Take[#, 66] &@ Union@ Table[FromDigits[RotateRight@ #, 2] + FromDigits[RotateLeft@ #, 2] &@ IntegerDigits[n, 2], {n, 0, 10^3}] (* _Michael De Vlieger_, May 17 2016 *)

%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 a = [0]

%o for n in range(1, 1000): a.append(ROR(n) + ROL(n))

%o print(sorted(set(a)))

%Y Cf. A006257, A038572, A088161, A088163, A273105.

%K nonn,base

%O 0,2

%A _Alex Ratushnyak_, May 15 2016