login
A328566
a(n) is the sum of the elements of the set O_n = {(n-k) OR k, k = 0..n} (where OR denotes the bitwise OR operator).
4
0, 0, 1, 3, 3, 9, 8, 14, 7, 25, 21, 37, 18, 46, 31, 45, 15, 65, 54, 96, 45, 119, 79, 115, 38, 130, 97, 159, 65, 155, 94, 124, 31, 161, 135, 243, 112, 304, 199, 289, 93, 331, 246, 404, 163, 393, 237, 313, 78, 338, 267, 461, 199, 517, 326, 456, 133, 443, 317, 505
OFFSET
-1,4
COMMENTS
The number of elements of the set O_n appears to be A002487(n+1); a(-1) = 0 as O_{-1} is the empty set.
Row sums of A326820.
FORMULA
a(n) <= n + A006583(n) for n >= 2.
MAPLE
a:= n-> add(i, i={seq(Bits[Or](n-k, k), k=0..n)}):
seq(a(n), n=-1..80); # Alois P. Heinz, Oct 20 2019
PROG
(PARI) a(n) = vecsum(Set(apply(k -> bitor(k, n-k), [0..n])))
(Python)
def A328566(n): return sum(set(k|n-k for k in range((n>>1)+1))) # Chai Wah Wu, May 07 2023
CROSSREFS
Cf. A328564 (AND variant), A328565 (XOR variant).
Sequence in context: A019745 A173815 A188615 * A362046 A155686 A290300
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Oct 20 2019
STATUS
approved