A053641 Rotate n one binary digit to the right, drop leading zeros, then rotate one binary digit to the left.
1, 1, 3, 1, 5, 3, 7, 1, 9, 3, 11, 5, 13, 7, 15, 1, 17, 3, 19, 5, 21, 7, 23, 9, 25, 11, 27, 13, 29, 15, 31, 1, 33, 3, 35, 5, 37, 7, 39, 9, 41, 11, 43, 13, 45, 15, 47, 17, 49, 19, 51, 21, 53, 23, 55, 25, 57, 27, 59, 29, 61, 31, 63, 1
Offset: 1
Examples
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).
Links
- Jason Yuen, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
rtt[f_, n_] := FromDigits[f[IntegerDigits[n, 2]], 2]; Array[rtt[RotateLeft, rtt[RotateRight, #]]&, 100] (* Paolo Xausa, Jan 16 2024 *)
-
PARI
a(n) = if(bitand(n,1), n, n+1 - 1<
Kevin Ryde, Jan 13 2024