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.

A262881 Regular triangle where the n-th row lists the integers k between 0 and n ordered by increasing value of the Hamming weight of k, and if equal by increasing value of k.

Original entry on oeis.org

0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 4, 3, 0, 1, 2, 4, 3, 5, 0, 1, 2, 4, 3, 5, 6, 0, 1, 2, 4, 3, 5, 6, 7, 0, 1, 2, 4, 8, 3, 5, 6, 7, 0, 1, 2, 4, 8, 3, 5, 6, 9, 7, 0, 1, 2, 4, 8, 3, 5, 6, 9, 10, 7, 0, 1, 2, 4, 8, 3, 5, 6, 9, 10, 7, 11, 0, 1, 2, 4, 8, 3, 5, 6, 9, 10, 12, 7, 11
Offset: 0

Views

Author

Michel Marcus, Oct 04 2015

Keywords

Examples

			Triangle starts:
0;
0, 1;
0, 1, 2;
0, 1, 2, 3;
0, 1, 2, 4, 3;
0, 1, 2, 4, 3, 5;
0, 1, 2, 4, 3, 5, 6;
0, 1, 2, 4, 3, 5, 6, 7;
0, 1, 2, 4, 8, 3, 5, 6, 7;
0, 1, 2, 4, 8, 3, 5, 6, 9, 7;
0, 1, 2, 4, 8, 3, 5, 6, 9, 10, 7;
...
		

Crossrefs

Cf. A000120 (Hamming weight), A262882 (right diagonal).

Programs

  • Mathematica
    Table[SortBy[Range@ k, And[Total@ IntegerDigits[#, 2], k] &], {k, 10}] (* Michael De Vlieger, Oct 04 2015 *)
  • PARI
    cmph(i, j) = if (hammingweight(i) != hammingweight(j), hammingweight(i) - hammingweight(j), i - j);
    row(n) = my(v = vector(n+1, k, k-1)); vecsort(v, cmph);
    tabl(nn) = for (n=0, nn, print(row(n)););