A184616 Negated negative parts of the nonadjacent forms.
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
Keywords
Examples
(see A184615)
Links
- Rémy Sigrist, Table of n, a(n) for n = 0..8192
- Pages 61-62 of Matters Computational (The Fxtbook).
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)
Comments