login
A101080
Table of Hamming distances between binary vectors representing i and j, for i >= 0, j >= 0, read by antidiagonals.
19
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, 1, 2, 1, 2, 0, 2, 1, 2, 1, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 1, 2, 1, 1, 0, 1, 1, 2, 1, 2, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 1, 2, 2, 1, 0, 1, 2, 2, 1, 2, 2, 3, 3, 2, 2, 3, 3, 1, 1, 3, 3, 2, 2, 3, 3
OFFSET
0,7
COMMENTS
a(n,0) = a(0,n) = A000120(n).
LINKS
FORMULA
a(i,j) = A000120(A003987(i,j)).
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
Sequence in context: A321858 A334235 A230415 * A130836 A279185 A161385
KEYWORD
easy,nonn,tabl
AUTHOR
Marc LeBrun, Nov 29 2004
STATUS
approved