|
|
A166267
|
|
Number of 1's in the binary representation of A000129(n).
|
|
1
|
|
|
0, 1, 1, 2, 2, 4, 3, 4, 4, 7, 5, 8, 6, 7, 10, 11, 10, 8, 13, 12, 12, 14, 16, 17, 11, 14, 17, 20, 16, 17, 19, 21, 23, 17, 17, 19, 24, 24, 25, 18, 29, 26, 29, 26, 26, 29, 35, 29, 26, 40, 29, 33, 33, 38, 36, 34, 28, 38, 42, 40, 37, 34, 40, 27, 45, 35, 37, 41, 40, 44, 48, 45, 41, 45
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,4
|
|
LINKS
|
|
|
FORMULA
|
|
|
MATHEMATICA
|
Clear[a, b, c, f, n, lst] f[n_]:=Plus@@IntegerDigits[n, 2]; a=1; b=0; c=0; lst={b}; Do[c=a+b+c; AppendTo[lst, f[c]]; a=b; b=c, {n, 5!}]; lst
DigitCount[LinearRecurrence[{2, 1}, {0, 1}, 100], 2, 1] (* Amiram Eldar, Jul 29 2023 *)
|
|
PROG
|
(Python)
if n <=1:
return n
else:
a=0
sh=n
while sh > 0:
a += sh & 1
sh >>= 1
return a
print([A166267(n) for n in range(30)])
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|