OFFSET
0,3
COMMENTS
a(3*n) = n.
Fixed points of the transform are listed in A048328.
LINKS
Indranil Ghosh, Table of n, a(n) for n = 0..19683 (terms 0..1000 Paolo P. Lava)
EXAMPLE
10 in base 3 is 101: moving the least significant digit to the most significant one we have 110 that is 12 in base 10.
MAPLE
with(numtheory): P:=proc(q, h) local a, b, k, n; print(0);
for n from 1 to q do
a:=convert(n, base, h); b:=[]; for k from 2 to nops(a) do b:=[op(b), a[k]]; od; a:=[op(b), a[1]];
a:=convert(a, base, h, 10); b:=0; for k from nops(a) by -1 to 1 do b:=10*b+a[k]; od;
print(b); od; end: P(10^4, 3);
MATHEMATICA
roll[n_, b_] := Block[{w = IntegerDigits[n, b]}, Prepend[Most@ w, Last@ w]]; b = 3; FromDigits[#, b] & /@ (roll[#, b] & /@ Range[0, 69]) (* Michael De Vlieger, Mar 04 2015 *)
Table[FromDigits[RotateRight[IntegerDigits[n, 3]], 3], {n, 0, 70}] (* Harvey P. Dale, Feb 20 2022 *)
PROG
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
Paolo P. Lava, Feb 27 2015
STATUS
approved