login
The (decimal equivalent of the) smallest integer that can be made by rotating the base three digits of n any number of positions to the left or right.
1

%I #14 Feb 28 2015 23:17:09

%S 1,2,1,4,5,2,5,8,1,4,7,4,13,14,5,14,17,2,5,8,7,14,17,8,17,26,1,4,7,10,

%T 13,16,11,22,25,4,13,22,13,40,41,14,41,44,5,14,23,16,41,50,17,44,53,2,

%U 5,8,11,14,17,20,23,26,7,16,25,22,41,44,23,50,53,8

%N The (decimal equivalent of the) smallest integer that can be made by rotating the base three digits of n any number of positions to the left or right.

%C The corresponding sequence using binary representations is given in A163381.

%H Alois P. Heinz, <a href="/A212713/b212713.txt">Table of n, a(n) for n = 1..6559</a>

%e For n=10, the rotations are 101(base 3)=10, 011=4, and 110=12, so a(10)=4.

%p a:= proc(n) local i, k, m, s;

%p k, m, s:= ilog[3](n), n, n;

%p for i to k do m:= iquo(m, 3, 'd') +d*3^k; s:=s, m od;

%p min(s)

%p end:

%p seq(a(n), n=1..80); # _Alois P. Heinz_, May 24 2012

%t a = {}; For[n = 1, n <= 100, n++, {m = n; d = IntegerDigits[n, 3];

%t For[k = 1, k <= Length[d], k++, {d = RotateLeft[d]; v = FromDigits[d, 3]; If[v < m, m = v]; }]; AppendTo[a, m]}]; a

%Y Cf. A163381.

%K nonn,base,look

%O 1,2

%A _John W. Layman_, May 24 2012