OFFSET
0,4
COMMENTS
Every integer appears in the sequence.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..6561
FORMULA
EXAMPLE
a(42) = a(1*3^3 + 1*3^2 + 2*3^1) = -2^3 - 2^2 + 2^1 = -10.
PROG
(PARI) a(n) = my (d=Vecrev(digits(n, 3))); sum(i=1, #d, if (d[i], (2^i) * (-1)^d[i], 0))/2
(Python)
from sympy.ntheory.factor_ import digits
def A328749(n): return sum((-(1<<i) if j&1 else 1<<i) for i, j in enumerate(digits(n, 3)[-1:0:-1]) if j>0) # Chai Wah Wu, Apr 12 2023
CROSSREFS
KEYWORD
sign,base
AUTHOR
Rémy Sigrist, Oct 27 2019
STATUS
approved