OFFSET
0,3
LINKS
EXAMPLE
A353828(7) = 5, so a(5) = 7.
PROG
(PARI) a(n) = {
my (d=[], t, p=1);
while (n, d=concat(t=[0, 1, -1][1+n%3], d); n=(n-t)/3);
for (k=1, #d, if (d[k], p*=d[k]=p*d[k]));
fromdigits(d, 3);
}
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, May 08 2022
STATUS
approved