login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A101080 Table of Hamming distances between binary vectors representing i and j, for i >= 0, j >= 0, read by antidiagonals. 17
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 (list; table; graph; refs; listen; history; text; internal format)
OFFSET

0,7

COMMENTS

a(n,0) = a(0,n) = A000120(n).

LINKS

Alois P. Heinz, Antidiagonals n = 0..200, flattened

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

Cf. A000120, A003987.

Sequence in context: A321858 A334235 A230415 * A130836 A279185 A161385

Adjacent sequences:  A101077 A101078 A101079 * A101081 A101082 A101083

KEYWORD

easy,nonn,tabl

AUTHOR

Marc LeBrun, Nov 29 2004

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 19 12:43 EDT 2021. Contains 345129 sequences. (Running on oeis4.)