cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A101080 Table of Hamming distances between binary vectors representing i and j, for i >= 0, j >= 0, read by antidiagonals.

This page as a plain text file.
%I A101080 #21 Apr 30 2020 14:53:34
%S A101080 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,
%T A101080 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,
%U A101080 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
%N A101080 Table of Hamming distances between binary vectors representing i and j, for i >= 0, j >= 0, read by antidiagonals.
%C A101080 a(n,0) = a(0,n) = A000120(n).
%H A101080 Alois P. Heinz, <a href="/A101080/b101080.txt">Antidiagonals n = 0..200, flattened</a>
%F A101080 a(i,j) = A000120(A003987(i,j)).
%e A101080 a(3,5) = 2 because the binary Hamming distance (number of differing bits) between ...0011 and ...0101 is 2.
%e A101080 From _Indranil Ghosh_, Mar 31 2017: (Start)
%e A101080 Array begins:
%e A101080   0, 1, 1, 2, 1, 2, 2, 3, ...
%e A101080   1, 0, 2, 1, 2, 1, 3, 2, ...
%e A101080   1, 2, 0, 1, 2, 3, 1, 2, ...
%e A101080   2, 1, 1, 0, 3, 2, 2, 1, ...
%e A101080   1, 2, 2, 3, 0, 1, 1, 2, ...
%e A101080   2, 1, 3, 2, 1, 0, 2, 1, ...
%e A101080   2, 3, 1, 2, 1, 2, 0, 1, ...
%e A101080   3, 2, 2, 1, 2, 1, 1, 0, ...
%e A101080   ...
%e A101080 Triangle formed when the array is read by antidiagonals:
%e A101080   0;
%e A101080   1, 1;
%e A101080   1, 0, 1;
%e A101080   2, 2, 2, 2;
%e A101080   1, 1, 0, 1, 1;
%e A101080   2, 2, 1, 1, 2, 2;
%e A101080   2, 1, 2, 0, 2, 1, 2;
%e A101080   3, 3, 3, 3, 3, 3, 3, 3;
%e A101080   ...
%e A101080 (End)
%p A101080 H:= (i, j)-> add(v, v=convert(Bits[Xor](i, j), base, 2)):
%p A101080 seq(seq(H(n, d-n), n=0..d), d=0..20);  # _Alois P. Heinz_, Nov 18 2015
%t A101080 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 *)
%o A101080 (PARI) b(n) = if(n<1, 0, b(n\2) + n%2);
%o A101080 tabl(nn) = {for(n=0, nn, for(k=0, n, print1(b(bitxor(k, n - k)),", ");); print(););};
%o A101080 tabl(20) \\ _Indranil Ghosh_, Mar 31 2017
%o A101080 (Python)
%o A101080 for n in range(20):
%o A101080     print([bin(k^(n - k))[2:].count("1") for k in range(n + 1)]) # _Indranil Ghosh_, Mar 31 2017
%Y A101080 Cf. A000120, A003987.
%K A101080 easy,nonn,tabl
%O A101080 0,7
%A A101080 _Marc LeBrun_, Nov 29 2004