|
|
A071295
|
|
Product of numbers of 0's and 1's in binary representation of n.
|
|
6
|
|
|
0, 0, 1, 0, 2, 2, 2, 0, 3, 4, 4, 3, 4, 3, 3, 0, 4, 6, 6, 6, 6, 6, 6, 4, 6, 6, 6, 4, 6, 4, 4, 0, 5, 8, 8, 9, 8, 9, 9, 8, 8, 9, 9, 8, 9, 8, 8, 5, 8, 9, 9, 8, 9, 8, 8, 5, 9, 8, 8, 5, 8, 5, 5, 0, 6, 10, 10, 12, 10, 12, 12, 12, 10, 12, 12, 12, 12, 12, 12, 10, 10, 12, 12, 12, 12, 12, 12, 10, 12, 12, 12
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,5
|
|
COMMENTS
|
a(n) = 0 iff n=2^k-1 for some k.
|
|
LINKS
|
|
|
FORMULA
|
a(n) = a(floor(n/2)) + (1 - n mod 2) * A000120(floor(n/2)) + (n mod 2)*A023416(floor(n/2)).
|
|
EXAMPLE
|
a(14)=3 because 14 is 1110 in binary and has 3 ones and 1 zero.
|
|
MATHEMATICA
|
f[n_] := Block[{s = IntegerDigits[n, 2]}, Count[s, 0] Count[s, 1]]; Table[ f[n], {n, 0, 90}]
Table[DigitCount[n, 2, 1]DigitCount[n, 2, 0], {n, 0, 100}] (* Harvey P. Dale, Sep 19 2019 *)
|
|
PROG
|
(Haskell)
(Python)
return bin(n)[1:].count('0')*bin(n).count('1') # Chai Wah Wu, Dec 23 2019
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,nice,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|