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

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A334913 a(n) is the sum of digits of n in signed binary nonadjacent form. 2
 0, 1, 1, 0, 1, 2, 0, 0, 1, 2, 2, -1, 0, 1, 0, 0, 1, 2, 2, 1, 2, 3, -1, -1, 0, 1, 1, -1, 0, 1, 0, 0, 1, 2, 2, 1, 2, 3, 1, 1, 2, 3, 3, -2, -1, 0, -1, -1, 0, 1, 1, 0, 1, 2, -1, -1, 0, 1, 1, -1, 0, 1, 0, 0, 1, 2, 2, 1, 2, 3, 1, 1, 2, 3, 3, 0, 1, 2, 1, 1, 2, 3, 3, 2 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,6 LINKS Table of n, a(n) for n=0..83. Joerg Arndt, Matters Computational - Ideas, Algorithms, Source Code, 2011, Springer, pp. 61-62. Helmut Prodinger, On binary representations of integers with digits -1,0,1, Integers 0 (2000), #A08. FORMULA a(n) = hammingweight(A184615(n)) - hammingweight(A184616(n)). - Joerg Arndt, Jun 13 2020 MATHEMATICA BBN[a_] := Module[{n = a, b}, b = IntegerDigits[n, 2]; b = Prepend[b, 0]; l = Length[b]; Do[If[b[[i]] == 2, b[[i]] = 0; b[[i - 1]]++, If[b[[i]] == 1, If[b[[i + 1]] == 1, b[[i - 1]]++; b[[i]] = 0; b[[i + 1]] = -1]]], {i, l - 1, 2, -1}]; If[b[[1]] == 0, b = Delete[b, 1]]; b] Table[a = BBN[i]; sod = 0; l = Length[a]; Do[sod = sod + a[[j]], {j, 1, l}]; sod, {i, 0, 83}] PROG (PARI) bin2naf(x)= { /* Compute (nonadjacent) signed binary representation of x: */ local(xh, x3, c, np, nm); xh = x >> 1; x3 = x + xh; c = bitxor(xh, x3); np = bitand(x3, c); /* bits == +1 */ nm = bitand(xh, c); /* bits == -1 */ return([np, nm]); /* np-nm==x */ } a(n) = my(b=bin2naf(n)); return(hammingweight(b[1])-hammingweight(b[2])); vector(99, n, a(n-1)) \\ Joerg Arndt, Jun 13 2020 CROSSREFS Cf. A000120, A001045, A007302, A184615, A184616. Sequence in context: A039971 A205593 A277937 * A112020 A069160 A089616 Adjacent sequences: A334910 A334911 A334912 * A334914 A334915 A334916 KEYWORD base,easy,sign AUTHOR Lei Zhou, May 16 2020 STATUS approved

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.

Last modified September 12 12:03 EDT 2024. Contains 375851 sequences. (Running on oeis4.)