login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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

%I #16 May 08 2023 02:10:46

%S 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,

%T 92,69,110,49,114,72,98,31,130,105,180,84,212,139,198,69,222,164,262,

%U 111,258,159,212,62,244,191,322,143,358,228,318,101,326,235,372,148

%N 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).

%C 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.

%C Row sums of A328568.

%H Rémy Sigrist, <a href="/A328565/b328565.txt">Table of n, a(n) for n = -1..8192</a>

%H Rémy Sigrist, <a href="/A328565/a328565.png">Scatterplot of (x, y) where x = 0..1023 and y belongs to X_x</a>

%F a(n) <= n + A006582(n) for n >= 2.

%p a:= n-> add(i, i={seq(Bits[Xor](n-k, k), k=0..n)}):

%p seq(a(n), n=-1..80); # _Alois P. Heinz_, Oct 20 2019

%o (PARI) a(n) = vecsum(Set(apply(k -> bitxor(k, n-k), [0..n])))

%o (Python)

%o def A328565(n): return sum(set(k^n-k for k in range((n>>1)+1))) # _Chai Wah Wu_, May 07 2023

%Y Cf. A328564 (AND variant), A328566 (OR variant).

%Y Cf. A002487, A006582, A328568.

%K nonn,base

%O -1,4

%A _Rémy Sigrist_, Oct 20 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 10 04:04 EDT 2024. Contains 372356 sequences. (Running on oeis4.)