|
|
A335587
|
|
a(n) is the sum of the numbers k such that 0 <= k <= n and n AND k = 0 (where AND denotes the bitwise AND operator).
|
|
2
|
|
|
0, 0, 1, 0, 6, 2, 1, 0, 28, 12, 10, 4, 6, 2, 1, 0, 120, 56, 52, 24, 44, 20, 18, 8, 28, 12, 10, 4, 6, 2, 1, 0, 496, 240, 232, 112, 216, 104, 100, 48, 184, 88, 84, 40, 76, 36, 34, 16, 120, 56, 52, 24, 44, 20, 18, 8, 28, 12, 10, 4, 6, 2, 1, 0, 2016, 992, 976, 480
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,5
|
|
COMMENTS
|
All terms can be written as m * 2^A000120(m) for some m >= 0.
|
|
LINKS
|
|
|
FORMULA
|
a(2*n+1) = 2*a(n).
a(2^k-1) = 0 for any k >= 0.
a(2^k) = A006516(k) for any k >= 0.
|
|
EXAMPLE
|
For n = 4:
- 4 AND 0 = 0,
- 4 AND 1 = 0,
- 4 AND 2 = 0,
- 4 AND 3 = 0,
- 4 AND 4 = 4,
- so a(4) = 0 + 1 + 2 + 3 = 6.
|
|
PROG
|
(PARI) a(n) = sum(k=0, n, if (bitand(n, k)==0, k, 0))
(PARI) a(n) = my (w=#binary(n)); ( (2^w-1-n) * 2^(w-hammingweight(n)) ) \ 2
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|