OFFSET
0,7
COMMENTS
a(n,0) = a(0,n) = A000120(n).
LINKS
Alois P. Heinz, Antidiagonals n = 0..200, flattened
EXAMPLE
a(3,5) = 2 because the binary Hamming distance (number of differing bits) between ...0011 and ...0101 is 2.
From Indranil Ghosh, Mar 31 2017: (Start)
Array begins:
0, 1, 1, 2, 1, 2, 2, 3, ...
1, 0, 2, 1, 2, 1, 3, 2, ...
1, 2, 0, 1, 2, 3, 1, 2, ...
2, 1, 1, 0, 3, 2, 2, 1, ...
1, 2, 2, 3, 0, 1, 1, 2, ...
2, 1, 3, 2, 1, 0, 2, 1, ...
2, 3, 1, 2, 1, 2, 0, 1, ...
3, 2, 2, 1, 2, 1, 1, 0, ...
...
Triangle formed when the array is read by antidiagonals:
0;
1, 1;
1, 0, 1;
2, 2, 2, 2;
1, 1, 0, 1, 1;
2, 2, 1, 1, 2, 2;
2, 1, 2, 0, 2, 1, 2;
3, 3, 3, 3, 3, 3, 3, 3;
...
(End)
MAPLE
H:= (i, j)-> add(v, v=convert(Bits[Xor](i, j), base, 2)):
seq(seq(H(n, d-n), n=0..d), d=0..20); # Alois P. Heinz, Nov 18 2015
MATHEMATICA
a[i_, j_] := Total[IntegerDigits[BitXor[i, j], 2]]; Table[a[i-j, j], {i, 0, 20}, {j, 0, i}] // Flatten (* Jean-François Alcover, Apr 07 2016 *)
PROG
(PARI) b(n) = if(n<1, 0, b(n\2) + n%2);
tabl(nn) = {for(n=0, nn, for(k=0, n, print1(b(bitxor(k, n - k)), ", "); ); print(); ); };
tabl(20) \\ Indranil Ghosh, Mar 31 2017
(Python)
for n in range(20):
print([bin(k^(n - k))[2:].count("1") for k in range(n + 1)]) # Indranil Ghosh, Mar 31 2017
CROSSREFS
KEYWORD
AUTHOR
Marc LeBrun, Nov 29 2004
STATUS
approved