%I #19 Mar 29 2018 18:18:55
%S 1,8,30,67,125,222,349,512,738,1009,1340,1740,2200,2744,3390,4102,
%T 4913,5850,6877,8018,9282,10660,12176,13848,15631,17576,19710,21979,
%U 24416,27003,29794,32768,35943,39337,42902,46692,50662,54881,59331,64030,68921
%N a(n) = n OR n^3 (applied to ternary expansions).
%H Alois P. Heinz, <a href="/A008469/b008469.txt">Table of n, a(n) for n = 1..10000</a>
%p a:= proc(n) option remember; local g, h, i, r;
%p g, h, r:= n, n^3, 0; for i from 0 while h>0 do
%p r:= r + 3^i * max(irem(g, 3, 'g'), irem(h, 3, 'h')) od; r
%p end:
%p seq(a(n), n=1..140); # _Alois P. Heinz_, Mar 29 2018
%t (* program should not be used to extend this sequence *)
%t b=3; d=12; Mb=Array[ b^(d-#)&, d ]; Map[ Plus@@(Mb*#)&, Array[ Max /@ Transpose[ {IntegerDigits[ #, b, d ], IntegerDigits[ #^3, b, d ]} ]&, 80 ] ]
%Y Cf. A007745, A008467, A008468.
%K base,nonn,easy
%O 1,2
%A _Olivier GĂ©rard_