OFFSET
1,4
COMMENTS
Every integer appears once in the sequence.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..5461
PROG
(PARI) for (n=0, 297, t = Vecrev(digits(n, 3)); if (sum(k=1, #t-1, t[k]*t[k+1])==0, print1 (sum(k=1, #t, if (t[k], 2^k*(-1)^t[k], 0)/2) ", ")))
(Python)
from itertools import count, islice
from gmpy2 import digits
def A328728_gen(startvalue=0): # generator of terms >= startvalue
for n in count(max(startvalue, 0)):
s = digits(n, 3)
for i in range(len(s)-1):
if '0' not in s[i:i+2]:
break
else:
yield sum((-(1<<i) if int(j)&1 else 1<<i) for i, j in enumerate(s[::-1]) if j!='0')
CROSSREFS
KEYWORD
sign,base
AUTHOR
Rémy Sigrist, Oct 26 2019
STATUS
approved