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!)
A163380 a(n) = the (decimal equivalent of the) largest integer that can be made by rotating the binary digits of n any number of positions to the left or right. 5

%I #20 Sep 24 2017 02:31:38

%S 1,2,3,4,6,6,7,8,12,10,14,12,14,14,15,16,24,20,28,20,26,26,30,24,28,

%T 26,30,28,30,30,31,32,48,40,56,36,50,52,60,40,52,42,58,50,54,58,62,48,

%U 56,50,60,52,58,54,62,56,60,58,62,60,62,62,63,64,96,80,112,72,98,104,120

%N a(n) = the (decimal equivalent of the) largest integer that can be made by rotating the binary digits of n any number of positions to the left or right.

%C By rotating the binary digits of n, it is meant: Write n in binary without any leading 0's. To rotate this string to the right, say, by one position, first remove the rightmost digit and then append it on the left side of the remaining string. (So the least significant digit becomes the most significant digit.) Here, leading 0's are not removed after the first rotation, so that each binary string being rotated has the same number of binary digits as n has.

%H Alois P. Heinz, <a href="/A163380/b163380.txt">Table of n, a(n) for n = 1..8192</a>

%e 13 in binary is 1101. Rotating this just once to the right, we get 1110, 14 in decimal. If we rotate twice to the right, we would have had 0111 = 7 in decimal. Rotating 3 times, we end up with 1011, which is 11 in decimal. Rotating 4 times, we end up at the beginning with 1101 = 13. 14 is the largest of these, so a(13) = 14.

%p rot := proc(n,t) convert(n,base,2) ; bdgs := ListTools[Rotate](%,t) ; add(op(i,bdgs)*2^(i-1),i=1..nops(bdgs)) ; end: A163380 := proc(n) local a,r; a := n ; for r from 1 to ilog2(n) do a := max(a, rot(n,r)) ; od: a; end: seq(A163380(n),n=1..100) ; # _R. J. Mathar_, Aug 03 2009

%t Table[With[{d = IntegerDigits[n, 2]}, Max@ Map[FromDigits[#, 2] &@ RotateRight[d, #] &, Range[Length@ d]]], {n, 71}] (* _Michael De Vlieger_, Sep 23 2017 *)

%Y Cf. A163381, A163382, A256999.

%K base,nonn,look

%O 1,2

%A _Leroy Quet_, Jul 25 2009

%E More terms from _R. J. Mathar_, Aug 03 2009

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 April 24 20:08 EDT 2024. Contains 371963 sequences. (Running on oeis4.)