|
|
A008687
|
|
Number of 1's in 2's complement representation of -n.
|
|
17
|
|
|
0, 1, 1, 2, 1, 3, 2, 2, 1, 4, 3, 3, 2, 3, 2, 2, 1, 5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1, 6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2, 5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1, 7, 6, 6, 5, 6, 5, 5, 4, 6, 5, 5, 4, 5, 4, 4, 3, 6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,4
|
|
COMMENTS
|
Conjecture: a(n)+1 is the length of the Hirzebruch (negative) continued fraction for the Stern-Brocot tree fraction A007305(n)/A007306(n). - Andrey Zabolotskiy, Apr 17 2020
|
|
LINKS
|
|
|
FORMULA
|
a(n) = if n<=1 then n else (n mod 2) + a((n mod 2) + floor(n/2)). - Reinhard Zumkeller, Feb 05 2007
|
|
MATHEMATICA
|
|
|
PROG
|
(Haskell)
a008687 n = a008687_list !! n
a008687_list = 0 : 1 : c [1] where c (e:es) = e : c (es ++ [e+1, e])
(PARI) a(n) = if(n<2, n, n--; logint(n, 2) - hammingweight(n) + 2); \\ Kevin Ryde, Apr 14 2021
|
|
CROSSREFS
|
This is Guy Steele's sequence GS(4, 3) (see A135416).
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|