OFFSET
1,3
LINKS
Jason Yuen, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
a(60) = 29 because starting with 111100 the right rotation produces 011110, written as 11110 (i.e., 30) and the left rotation produces 11101 (i.e., 29).
MATHEMATICA
rtt[f_, n_] := FromDigits[f[IntegerDigits[n, 2]], 2];
Array[rtt[RotateLeft, rtt[RotateRight, #]]&, 100] (* Paolo Xausa, Jan 16 2024 *)
PROG
(PARI) a(n) = if(bitand(n, 1), n, n+1 - 1<<logint(n, 2)); \\ Kevin Ryde, Jan 13 2024
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Henry Bottomley, Mar 22 2000
STATUS
approved