A212713 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, 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, 13, 16, 11, 22, 25, 4, 13, 22, 13, 40, 41, 14, 41, 44, 5, 14, 23, 16, 41, 50, 17, 44, 53, 2, 5, 8, 11, 14, 17, 20, 23, 26, 7, 16, 25, 22, 41, 44, 23, 50, 53, 8
Offset: 1
Examples
For n=10, the rotations are 101(base 3)=10, 011=4, and 110=12, so a(10)=4.
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..6559
Crossrefs
Cf. A163381.
Programs
-
Maple
a:= proc(n) local i, k, m, s; k, m, s:= ilog[3](n), n, n; for i to k do m:= iquo(m, 3, 'd') +d*3^k; s:=s, m od; min(s) end: seq(a(n), n=1..80); # Alois P. Heinz, May 24 2012
-
Mathematica
a = {}; For[n = 1, n <= 100, n++, {m = n; d = IntegerDigits[n, 3]; For[k = 1, k <= Length[d], k++, {d = RotateLeft[d]; v = FromDigits[d, 3]; If[v < m, m = v]; }]; AppendTo[a, m]}]; a smr3[n_]:=With[{id3=IntegerDigits[n,3]},Min[FromDigits[#,3]&/@Table[RotateRight[id3,k],{k,Length[id3]}]]]; Array[smr3,80] (* Harvey P. Dale, Jan 29 2025 *)
Comments