login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A008467
a(n) = n OR n^2 (applied to ternary expansions).
3
1, 5, 12, 16, 26, 42, 52, 71, 90, 100, 122, 147, 178, 206, 231, 259, 296, 342, 370, 401, 453, 484, 539, 591, 646, 701, 756, 784, 842, 930, 961, 1025, 1095, 1186, 1259, 1332, 1369, 1445, 1524, 1609, 1691, 1770, 1852, 1943, 2070, 2152, 2237, 2316, 2401, 2510
OFFSET
1,2
COMMENTS
OR(a, b) = max(a, b) for ternary digits a and b. - Sean A. Irvine, Mar 29 2018
LINKS
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
STATUS
approved