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).
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
Offset: 0
Examples
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.
Links
- Rémy Sigrist, Table of n, a(n) for n = 0..8191
- Rémy Sigrist, Colored logarithmic scatterplot of the sequence for n < 2^16 (where the color is function of A080791(n))
- Index entries for sequences related to binary expansion of n
Programs
-
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
Comments