OFFSET
1,3
COMMENTS
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.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..8190
EXAMPLE
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.
MAPLE
a:= proc(n) local i, k, m, s;
k, m, s:= ilog2(n), n, n;
for i to k do m:= iquo(m, 2, 'd') +d*2^k; s:=s, m od;
min(s)
end:
seq(a(n), n=1..80); # Alois P. Heinz, May 24 2012
MATHEMATICA
Table[Min[FromDigits[ #, 2]&/@ NestList[RotateLeft, IntegerDigits[n, 2], Floor[Log[2, n]]]], {n, 255}] (* Wouter Meeussen, Jul 27 2009 *)
PROG
(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
CROSSREFS
KEYWORD
AUTHOR
Leroy Quet, Jul 25 2009
EXTENSIONS
More terms from Hagen von Eitzen and Wouter Meeussen, Jul 27 2009
STATUS
approved