OFFSET
0,3
COMMENTS
This sequence is similar to A003188.
LINKS
EXAMPLE
A341054(42) = 76, so a(76) = 42.
PROG
(PARI) a(n) = { my (d=[], s=Mod(0, 3)); while (n, my (t=centerlift(Mod(n, 3))); n=(n-t)\3; d=concat(t, d)); for (k=1, #d, d[k] = centerlift(d[k]-s); s+=d[k]); fromdigits(d, 3) }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Apr 25 2021
STATUS
approved