login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A328749 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 n. 3

%I #17 Apr 13 2023 02:35:37

%S 0,-1,1,-2,-3,-1,2,1,3,-4,-5,-3,-6,-7,-5,-2,-3,-1,4,3,5,2,1,3,6,5,7,

%T -8,-9,-7,-10,-11,-9,-6,-7,-5,-12,-13,-11,-14,-15,-13,-10,-11,-9,-4,

%U -5,-3,-6,-7,-5,-2,-3,-1,8,7,9,6,5,7,10,9,11,4,3,5,2,1,3,6

%N 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 n.

%C Every integer appears in the sequence.

%H Rémy Sigrist, <a href="/A328749/b328749.txt">Table of n, a(n) for n = 0..6561</a>

%F a(n) = 0 iff n = 0.

%F a(n) > 0 iff n belongs to A157671.

%F a(n) < 0 iff n belongs to A132141.

%F a(A004488(n)) = -a(n).

%e a(42) = a(1*3^3 + 1*3^2 + 2*3^1) = -2^3 - 2^2 + 2^1 = -10.

%o (PARI) a(n) = my (d=Vecrev(digits(n,3))); sum(i=1, #d, if (d[i], (2^i) * (-1)^d[i], 0))/2

%o (Python)

%o from sympy.ntheory.factor_ import digits

%o 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

%Y Cf. A004488, A132141, A157671, A328728.

%K sign,base

%O 0,4

%A _Rémy Sigrist_, Oct 27 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 08:28 EDT 2024. Contains 371782 sequences. (Running on oeis4.)