OFFSET
0,5
COMMENTS
The effect of NOT(n) AND k is to retain from k only those bits where n has a 0-bit. Conversely n AND k retains from k those bits where n has a 1-bit. Together they are all bits of k so that a(n) + A222423(n) = Sum_{k=0..n} k = n*(n+1)/2.
FORMULA
MAPLE
with(Bits): cnimp := (n, k) -> And(Not(n), k):
seq(add(cnimp(n, k), k = 0..n), n = 0..59); # Peter Luschny, Dec 14 2021
PROG
(PARI) a(n) = (3*fromdigits(binary(n), 4) - n^2 - 2*n)/4;
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Kevin Ryde, Dec 14 2021
STATUS
approved