login
A328565
a(n) is the sum of the elements of the set X_n = {(n-k) XOR k, k = 0..n} (where XOR denotes the bitwise XOR operator).
4
0, 0, 1, 2, 3, 6, 6, 10, 7, 18, 15, 24, 14, 32, 23, 34, 15, 50, 40, 66, 33, 78, 53, 76, 30, 92, 69, 110, 49, 114, 72, 98, 31, 130, 105, 180, 84, 212, 139, 198, 69, 222, 164, 262, 111, 258, 159, 212, 62, 244, 191, 322, 143, 358, 228, 318, 101, 326, 235, 372, 148
OFFSET
-1,4
COMMENTS
The number of elements of the set X_n appears to be A002487(n+1); a(-1) = 0 as X_{-1} is the empty set.
Row sums of A328568.
FORMULA
a(n) <= n + A006582(n) for n >= 2.
MAPLE
a:= n-> add(i, i={seq(Bits[Xor](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 -> bitxor(k, n-k), [0..n])))
(Python)
def A328565(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), A328566 (OR variant).
Sequence in context: A039799 A185423 A144583 * A308762 A155215 A363075
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Oct 20 2019
STATUS
approved