OFFSET
1,2
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
MAPLE
# take ifsSorted from A080670
A289667 := proc(n)
local Ldgs, p, eb, pb, b ;
b := 3;
if n = 1 then
return 1;
end if;
Ldgs := [] ;
for p in ifsSorted(n) do
pb := convert(op(1, p), base, b) ;
Ldgs := [op(pb), op(Ldgs)] ;
if op(2, p) > 1 then
eb := convert(op(2, p), base, b) ;
Ldgs := [op(eb), op(Ldgs)] ;
end if;
end do:
add( op(e, Ldgs)*b^(e-1), e=1..nops(Ldgs)) ;
end proc:
seq(A289667(n), n=1..30) ; # R. J. Mathar, Aug 05 2017
MATHEMATICA
Table[FromDigits[#, 3] &@ Flatten@ Map[IntegerDigits[#, 3] &, FactorInteger[n] /. {p_, e_} /; p > 0 :> If[e == 1, p, {p, e}]], {n, 64}] (* Michael De Vlieger, Jul 29 2017 *)
PROG
(PARI) a(n) = {if (n==1, return(1)); f = factor(n); s = []; for (i=1, #f~, s = concat(s, digits(f[i, 1], 3)); if (f[i, 2] != 1, s = concat(s, digits(f[i, 2], 3))); ); fromdigits(s, 3); } \\ Michel Marcus, Jul 27 2017
CROSSREFS
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Jul 27 2017
EXTENSIONS
More terms from Michel Marcus, Jul 27 2017
STATUS
approved