A336953 In binary representation, rotate the digits of n right n places.
0, 1, 2, 3, 2, 3, 6, 7, 8, 12, 10, 7, 12, 14, 11, 15, 8, 12, 10, 7, 20, 26, 21, 30, 17, 25, 13, 30, 19, 27, 30, 31, 8, 12, 10, 7, 36, 50, 41, 60, 34, 19, 42, 53, 11, 45, 58, 31, 48, 56, 44, 30, 19, 43, 54, 59, 14, 15, 43, 55, 60, 62, 47, 63, 32, 48, 40, 28
Offset: 0
Examples
a(3) = a('11') = '11' = 3; a(4) = a('100') = '010' = '10' = 2; a(5) = a('101') = '011' = '11' = 3;
Links
- Rémy Sigrist, Table of n, a(n) for n = 0..16384
Crossrefs
Programs
-
Mathematica
Array[FromDigits[RotateRight[IntegerDigits[#, 2], #], 2] &, 68, 0] (* Michael De Vlieger, Oct 05 2020 *)
-
PARI
a(n) = my(d=binary(n)); for (k=1, n, d = concat(d[#d], d[1..#d-1])); fromdigits(d, 2); \\ Michel Marcus, Aug 09 2020
-
Python
def A336953(n): if n == 0: return 0 l, m = -(n%n.bit_length()), bin(n)[2:] return int(m[l:]+m[:l],2) # Chai Wah Wu, Jan 22 2023
Comments