login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A053642 Rotate n one binary digit to the left, drop leading zeros, then rotate one binary digit to the right. 2
1, 1, 3, 1, 3, 6, 7, 1, 3, 6, 7, 12, 13, 14, 15, 1, 3, 6, 7, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31, 1, 3, 6, 7, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
COMMENTS
Sequence contains ever-longer copies of A004760. - Ralf Stephan, Sep 16 2003
LINKS
FORMULA
a(n) = A038572(A006257(n)).
a(n) = n if 3*2^(k-1) <= n < 2^(k+1);
a(n) = a(n - 2^(k-1)) if 2^k <= n < 3*2^(k-1).
a(2n) = 2a(n) - [a(n)==1], a(2n+1) = 2a(n) + 1. - Ralf Stephan, Sep 16 2003
EXAMPLE
a(22)=14 because starting with 10110 the left rotation produces 01101 written as 1101 (i.e., 13) and the right rotation produces 1110 (i.e., 14).
MATHEMATICA
rtt[f_, n_] := FromDigits[f[IntegerDigits[n, 2]], 2];
Array[rtt[RotateRight, rtt[RotateLeft, #]]&, 100] (* Paolo Xausa, Jan 16 2024 *)
PROG
(PARI) a(n) = n-=1<<logint(n, 2); n + 1<<if(n, logint(n, 2)+1); \\ Kevin Ryde, Jan 13 2024
CROSSREFS
Cf. A053641 (right then left).
Sequence in context: A176106 A302867 A058659 * A171961 A205121 A152903
KEYWORD
nonn,base,easy
AUTHOR
Henry Bottomley, Mar 22 2000
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 15:38 EDT 2024. Contains 371254 sequences. (Running on oeis4.)