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.

A091444 Concatenate binary vectors ordered first by length, then by the number of 1's and finally lexicographically.

Original entry on oeis.org

0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1
Offset: 0

Views

Author

Paul Boddington, Jan 10 2004

Keywords

Crossrefs

Programs

  • Mathematica
    c[n_, k_] := If[k == 0, {0}, If[k == n, {2^n - 1}, Join[c[n - 1, k], c[n - 1, k - 1] + 2^(n - 1)]]];
    b[n_] := If[n == 1, {0, 1}, Flatten[Table[c[n, k], {k, 0, n}]]];
    a[n_] := Map[PadLeft, IntegerDigits[Array[b, n], 2]];
    a[4] // Flatten (* Robert P. P. McKone, Aug 13 2021 *)
    Flatten[Table[SortBy[IntegerDigits[Range[0, 2^k - 1], 2, k], Total], {k, 4}]] (* Paolo Xausa, Jul 28 2025 *)
  • Python
    from itertools import product
    def sortby(x): return (len(x), x.count(1), x)
    def agen(maxvecdigits):
        for i in range(1, maxvecdigits+1):
            for t in sorted([p for p in product([0, 1], repeat=i)], key=sortby):
                yield from t
    print([an for an in agen(4)]) # Michael S. Branicky, Aug 13 2021