login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A366139
In binary representation, rotate the digits of n left n places.
3
0, 1, 2, 3, 1, 6, 6, 7, 8, 3, 10, 13, 12, 11, 11, 15, 1, 6, 20, 25, 20, 11, 26, 29, 12, 25, 21, 15, 7, 30, 30, 31, 2, 12, 40, 49, 36, 11, 26, 60, 10, 52, 42, 23, 50, 45, 43, 55, 48, 35, 11, 30, 13, 58, 54, 47, 35, 15, 46, 61, 60, 59, 59, 63, 1, 6, 20, 56, 17, 98
OFFSET
0,3
EXAMPLE
a(4) = 1 because 4 in base 2 is 100 and 100 rotated left 4 times is 100 -> 001 -> 010 -> 100 -> 001 = 1.
a(5) = 6 because 5 in base 2 is 101 and 101 rotated left 5 times is 101 -> 011 -> 110 -> 101 -> 011 -> 110 = 6 in base 10.
MATHEMATICA
A366139[n_]:=FromDigits[RotateLeft[IntegerDigits[n, 2], n], 2];
Array[A366139, 100, 0]
PROG
(Python)
def A366139(n): return int((s:=bin(n))[(m:=n%n.bit_length()+2):]+s[2:m], 2) if n else 0 # Chai Wah Wu, Oct 03 2023
CROSSREFS
Cf. A006257, A007088, A366140 (fixed points).
Cf. A336953 (rotate right).
Sequence in context: A074306 A294218 A356013 * A347945 A036039 A324254
KEYWORD
nonn,base,easy,look
AUTHOR
Paolo Xausa, Sep 30 2023
STATUS
approved