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.

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.

Original entry on oeis.org

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, -8, -9, -7, -10, -11, -9, -6, -7, -5, -12, -13, -11, -14, -15, -13, -10, -11, -9, -4, -5, -3, -6, -7, -5, -2, -3, -1, 8, 7, 9, 6, 5, 7, 10, 9, 11, 4, 3, 5, 2, 1, 3, 6
Offset: 0

Views

Author

Rémy Sigrist, Oct 27 2019

Keywords

Comments

Every integer appears in the sequence.

Examples

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

Crossrefs

Programs

  • 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<0) # Chai Wah Wu, Apr 12 2023

Formula

a(n) = 0 iff n = 0.
a(n) > 0 iff n belongs to A157671.
a(n) < 0 iff n belongs to A132141.
a(A004488(n)) = -a(n).