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.

A184616 Negated negative parts of the nonadjacent forms.

Original entry on oeis.org

0, 0, 0, 1, 0, 0, 2, 1, 0, 0, 0, 5, 4, 4, 2, 1, 0, 0, 0, 1, 0, 0, 10, 9, 8, 8, 8, 5, 4, 4, 2, 1, 0, 0, 0, 1, 0, 0, 2, 1, 0, 0, 0, 21, 20, 20, 18, 17, 16, 16, 16, 17, 16, 16, 10, 9, 8, 8, 8, 5, 4, 4, 2, 1, 0, 0, 0, 1, 0, 0, 2, 1, 0, 0, 0, 5, 4, 4, 2, 1, 0, 0, 0, 1, 0, 0, 42, 41
Offset: 0

Views

Author

Joerg Arndt, Jan 18 2011

Keywords

Comments

This sequence together with A184615 (positive parts) gives the (signed binary) nonadjacent form (NAF) of n, see fxtbook link and example in A184615.
No two adjacent bits in the binary representations of a(n) are 1.
No two adjacent bits in the binary representations of a(n)+A184615(n) are 1.

Examples

			(see A184615)
		

Crossrefs

Cf. A184615 (positive parts), A184617 (sums of both parts =A184615+A184616).

Programs

  • Mathematica
    bin2naf[x_] := Module[{xh, x3, c, np, nm},
      xh = BitShiftRight[x, 1];
      x3 = x + xh;
      c = BitXor[xh, x3];
      np = BitAnd[x3, c];
      nm = BitAnd[xh, c];
      Return[{np, nm}]];
    a[n_] := bin2naf[n][[2]];
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, May 30 2019, from PARI code in A184615 *)
  • PARI
    (see A184615)

Formula

A184615(n) - a(n) = n
a(n) + A184615(n) = A184617(n)