OFFSET
1,2
COMMENTS
OR(a, b) = max(a, b) for ternary digits a and b. - Sean A. Irvine, Mar 29 2018
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
MAPLE
a:= proc(n) option remember; local g, h, i, r;
g, h, r:= n, n^2, 0; for i from 0 while h>0 do
r:= r + 3^i * max(irem(g, 3, 'g'), irem(h, 3, 'h')) od; r
end:
seq(a(n), n=1..140); # Alois P. Heinz, Mar 29 2018
MATHEMATICA
(* program should not be used to extend this sequence *)
b=3; d=9; Mb=Array[ b^(d-#)&, d ]; Map[ Plus@@(Mb*#)&, Array[ Max /@ Transpose[ {IntegerDigits[ #, b, d ], IntegerDigits[ #^2, b, d ]} ]&, 140 ] ]
CROSSREFS
KEYWORD
base,nonn,easy
AUTHOR
STATUS
approved