cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A328728 a(n) = Sum_{k = 0..w and t_k > 0} (-1)^t_k * 2^k, where Sum_{k = 0..w} t_k * 3^k is the ternary representation of A328727(n).

This page as a plain text file.
%I A328728 #15 Apr 13 2023 08:30:10
%S A328728 0,-1,1,-2,2,-4,-5,-3,4,3,5,-8,-9,-7,-10,-6,8,7,9,6,10,-16,-17,-15,
%T A328728 -18,-14,-20,-21,-19,-12,-13,-11,16,15,17,14,18,12,11,13,20,19,21,-32,
%U A328728 -33,-31,-34,-30,-36,-37,-35,-28,-29,-27,-40,-41,-39,-42,-38,-24
%N A328728 a(n) = Sum_{k = 0..w and t_k > 0} (-1)^t_k * 2^k, where Sum_{k = 0..w} t_k * 3^k is the ternary representation of A328727(n).
%C A328728 Every integer appears once in the sequence.
%H A328728 Rémy Sigrist, <a href="/A328728/b328728.txt">Table of n, a(n) for n = 1..5461</a>
%F A328728 a(n) = A328749(A328727(n)).
%F A328728 Sum_{k = 1..n} a(k) = 0 iff n belongs to A001045.
%o A328728 (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) ", ")))
%o A328728 (Python)
%o A328728 from itertools import count, islice
%o A328728 from gmpy2 import digits
%o A328728 def A328728_gen(startvalue=0): # generator of terms >= startvalue
%o A328728     for n in count(max(startvalue,0)):
%o A328728         s = digits(n,3)
%o A328728         for i in range(len(s)-1):
%o A328728             if '0' not in s[i:i+2]:
%o A328728                 break
%o A328728         else:
%o A328728             yield sum((-(1<<i) if int(j)&1 else 1<<i) for i, j in enumerate(s[::-1]) if j!='0')
%o A328728 A328728_list = list(islice(A328728_gen(),20)) # _Chai Wah Wu_, Apr 12 2023
%Y A328728 Cf. A001045, A328727, A328749.
%K A328728 sign,base
%O A328728 1,4
%A A328728 _Rémy Sigrist_, Oct 26 2019