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.

A065360 Alternating sum of "negabits". Replace (-2)^k with (-1)^k in negabinary expansion of n.

Original entry on oeis.org

1, 0, 1, 1, 2, -1, 0, 0, 1, 0, 1, 1, 2, 0, 1, 1, 2, 1, 2, 2, 3, -2, -1, -1, 0, -1, 0, 0, 1, -1, 0, 0, 1, 0, 1, 1, 2, -1, 0, 0, 1, 0, 1, 1, 2, 0, 1, 1, 2, 1, 2, 2, 3, -1, 0, 0, 1, 0, 1, 1, 2, 0, 1, 1, 2, 1, 2, 2, 3, 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, -3, -2, -2, -1, -2, -1, -1, 0, -2, -1, -1, 0, -1, 0, 0, 1, -2, -1, -1, 0, -1, 0, 0
Offset: 1

Views

Author

Marc LeBrun, Oct 31 2001

Keywords

Comments

Notation: (-2)[n](-1)

Examples

			6 = 11010 -> +(1)-(1)+(0)-(1)+(0) = -1 = a(6).
		

Crossrefs

Programs

  • PARI
    negab(n)=if(n, negab(n\(-2))*10+bittest(n, 0)); \\ A039724
    a(n) = my(d=Vecrev(digits(negab(n)))); sum(k=1, #d, d[k]*(-1)^(k-1)); \\ Michel Marcus, Aug 28 2019