A065360 Alternating sum of "negabits". Replace (-2)^k with (-1)^k in negabinary expansion of n.
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
Examples
6 = 11010 -> +(1)-(1)+(0)-(1)+(0) = -1 = a(6).
Links
- Amiram Eldar, Table of n, a(n) for n = 1..10000
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
Comments