login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Irregular triangle read by rows; for n >= 0, the n-th row corresponds to the elements of the set {(n-k) XOR k, k = 0..n}, in ascending order (where XOR denotes the bitwise XOR operator).
4

%I #22 Jan 25 2024 07:55:02

%S 0,1,0,2,3,0,2,4,1,5,0,4,6,7,0,4,6,8,1,5,9,0,2,4,8,10,3,11,0,2,8,10,

%T 12,1,9,13,0,8,12,14,15,0,8,12,14,16,1,9,13,17,0,2,8,10,12,16,18,3,11,

%U 19,0,2,4,8,10,16,18,20,1,5,9,17,21,0,4,6,8,16,20,22

%N Irregular triangle read by rows; for n >= 0, the n-th row corresponds to the elements of the set {(n-k) XOR k, k = 0..n}, in ascending order (where XOR denotes the bitwise XOR operator).

%C For any n >= 0, the n-th row:

%C - has sum A328565(n),

%C - has apparently length A002487(n+1),

%C - has first element A135481(n),

%C - has last element n.

%H Rémy Sigrist, <a href="/A328568/b328568.txt">Table of n, a(n) for n = 0..9851</a>

%e Table begins:

%e 0;

%e 1;

%e 0, 2;

%e 3;

%e 0, 2, 4;

%e 1, 5;

%e 0, 4, 6;

%e 7;

%e 0, 4, 6, 8;

%e 1, 5, 9;

%e 0, 2, 4, 8, 10;

%e 3, 11;

%e 0, 2, 8, 10, 12;

%e 1, 9, 13;

%e 0, 8, 12, 14;

%e ...

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

%p seq(T(n), n=0..30); # _Alois P. Heinz_, Oct 20 2019

%t Union /@ Table[BitXor[n - k, k], {n, 0, 22}, {k, 0, n}] // Flatten (* _George Beck_, Jun 09 2023 *)

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

%Y Cf. A326819 (AND variant), A326820 (OR variant).

%Y Cf. A002487, A135481, A328565.

%K nonn,tabf,look,base

%O 0,4

%A _Rémy Sigrist_, Oct 20 2019