|
Search: id:A065359
|
|
|
| A065359 |
|
Alternating bit sum for n: replace 2^k with (-1)^k in binary expansion of n. |
|
+0 14
|
|
| 0, 1, -1, 0, 1, 2, 0, 1, -1, 0, -2, -1, 0, 1, -1, 0, 1, 2, 0, 1, 2, 3, 1, 2, 0, 1, -1, 0, 1, 2, 0, 1, -1, 0, -2, -1, 0, 1, -1, 0, -2, -1, -3, -2, -1, 0, -2, -1, 0, 1, -1, 0, 1, 2, 0, 1, -1, 0, -2, -1, 0, 1, -1, 0, 1, 2, 0, 1, 2, 3, 1, 2, 0, 1, -1, 0, 1, 2, 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 1, 2, 0, 1, 2, 3, 1, 2, 0, 1, -1, 0, 1, 2, 0, 1, -1, 0, -2
(list; graph; listen)
|
|
|
OFFSET
|
0,6
|
|
|
COMMENT
|
Notation: (2)[n](-1)
Comments from David W. Wilson and Ralf Stephan, Jan 09 2007: (Start)
a(n) is even iff n in A001969; a(n) is odd iff n in A000069.
a(n) == 0 (mod 3) iff n == 0 (mod 3).
a(n) == 0 (mod 6) iff (n == 0 (mod 3) and n/3 not in A036556).
a(n) == 3 (mod 6) iff (n == 0 (mod 3) and n/3 in A036556). (End)
a(n) = A030300(n) - A083905(n). - Ralf Stephan (ralf(AT)ark.in-berlin.de), Jul 12 2003
|
|
REFERENCES
|
J.-P. Allouche and J. Shallit, The ring of k-regular sequences, II, Theoret. Computer Sci., 307 (2003), 3-29.
|
|
LINKS
|
Harry J. Smith, Table of n, a(n) for n=0,...,1000
J.-P. Allouche and J. Shallit, The Ring of k-regular Sequences, II
William Paulsen, wpaulsen(AT)csm.astate.edu, Partitioning the [prime] maze
R. Stephan, Divide-and-conquer generating functions. I. Elementary sequences
R. Stephan, Some divide-and-conquer sequences ...
R. Stephan, Table of generating functions
|
|
FORMULA
|
G.f.: 1/(1-x) * sum(k>=0, (-1)^k*x^2^k/(1+x^2^k)). - Ralf Stephan (ralf(AT)ark.in-berlin.de), Mar 07 2003
a(0) = 0, a(2n) = -a(n), a(2n+1) = 1-a(n). - Ralf Stephan (ralf(AT)ark.in-berlin.de), Mar 07 2003
|
|
EXAMPLE
|
Alternating bit sum for 11 = 1011 in binary is 1 - 1 + 0 - 1 = -1, so a(11) = -1.
|
|
MATHEMATICA
|
f[n_] := (d = Reverse[ IntegerDigits[n, 2]]; l = Length[d]; s = 0; k = 1; While[k < l + 1, s = s - (-1)^k*d[[k]]; k++ ]; s); Table[ f[n], {n, 0, 100} ]
|
|
PROGRAM
|
(PARI) SumAD(x)= { local(a=1, s=0); while (x>9, s+=a*(x-10*(x\10)); x\=10; a=-a); return(s + a*x) } baseE(x, b)= { local(d, e=0, f=1); while (x>0, d=x-b*(x\b); x\=b; e+=d*f; f*=10); return(e) } { for (n=0, 1000, b=baseE(n, 2); write("b065359.txt", n, " ", SumAD(b)) ) } [From Harry J. Smith (hjsmithh(AT)sbcglobal.net), Oct 17 2009]
|
|
CROSSREFS
|
Cf. A000120, A065360, A065368, A065081.
Partial sums seem to be in A005536.
Sequence in context: A117355 A086966 A140080 this_sequence A087372 A036431 A029407
Adjacent sequences: A065356 A065357 A065358 this_sequence A065360 A065361 A065362
|
|
KEYWORD
|
base,easy,sign
|
|
AUTHOR
|
Marc LeBrun (mlb(AT)well.com), Oct 31 2001
|
|
EXTENSIONS
|
More terms from Ralf Stephan (ralf(AT)ark.in-berlin.de), Jul 12 2003
|
|
|
Search completed in 0.002 seconds
|