This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A163381 #20 Aug 05 2016 09:19:42 %S A163381 1,1,3,1,3,3,7,1,3,5,7,3,7,7,15,1,3,5,7,5,11,11,15,3,7,11,15,7,15,15, %T A163381 31,1,3,5,7,9,11,13,15,5,13,21,23,11,27,23,31,3,7,11,15,13,23,27,31,7, %U A163381 15,23,31,15,31,31,63,1,3,5,7,9,11,13,15,9,19,21,23,19,27,29,31,5,13,21,29 %N A163381 a(n) = the (decimal equivalent of the) smallest integer that can be made by rotating the binary digits of n any number of positions to the left or right. a(n) in binary may contain fewer digits, after leading 0's are removed, than n written in binary has. %C A163381 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 A163381 Alois P. Heinz, <a href="/A163381/b163381.txt">Table of n, a(n) for n = 1..8190</a> %e A163381 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. 7 is the smallest of these, so a(13) = 7. %p A163381 a:= proc(n) local i, k, m, s; %p A163381 k, m, s:= ilog2(n), n, n; %p A163381 for i to k do m:= iquo(m, 2, 'd') +d*2^k; s:=s, m od; %p A163381 min(s) %p A163381 end: %p A163381 seq(a(n), n=1..80); # _Alois P. Heinz_, May 24 2012 %t A163381 Table[Min[FromDigits[ #,2]&/@ NestList[RotateLeft,IntegerDigits[n,2], Floor[Log[2,n]]]],{n,255}] (* _Wouter Meeussen_, Jul 27 2009 *) %o A163381 (PARI) a(n)=local(k=#binary(n),m=2^k,t=n*(m+1));vecmin(vector(k,x,(t\2^x)%m)) \\ _Hagen von Eitzen_, Jul 27 2009 %Y A163381 Cf. A163380, A163382. %K A163381 base,nonn,look %O A163381 1,3 %A A163381 _Leroy Quet_, Jul 25 2009 %E A163381 More terms from _Hagen von Eitzen_ and _Wouter Meeussen_, Jul 27 2009