OFFSET
0,2
COMMENTS
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..6561
FORMULA
a(3^n) = 2. a(2*3^n) = 1.
EXAMPLE
53 -> 1222 -> 2111 -> 1112 -> 41.
MAPLE
a:= proc(n) local m, r; m, r:= n, 0; while m>0
do r:=r*3+[0, 2, 1][1+irem(m, 3, 'm')] od; r
end:
seq(a(n), n=0..100); # Alois P. Heinz, Jun 20 2016
MATHEMATICA
a[n_] := FromDigits[ Reverse[ IntegerDigits[n, 3] /. {1 -> 2, 2 -> 1}], 3] (* Giovanni Resta, Jun 20 2016 *)
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Jonathan Vos Post, Apr 20 2008
EXTENSIONS
Edited and corrected by Giovanni Resta, Jun 20 2016
STATUS
approved