OFFSET
0,3
COMMENTS
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..6561
FORMULA
a(n) = n iff n = 0 or n belongs to A038754.
EXAMPLE
For n = 107:
107 = 3^4 + 2*3^2 + 2*3^1 + 2*3^0,
so a(107) = -3^4 + 2*3^2 - 2*3^1 + 2*3^0 = -67.
PROG
(PARI) a(n, base=3) = { my (d=digits(n, base), s=1); forstep (k=#d, 1, -1, if (d[k], d[k]*=s; s=-s)); return (fromdigits(d, base)) }
CROSSREFS
KEYWORD
sign,base,easy
AUTHOR
Rémy Sigrist, Jul 14 2022
STATUS
approved