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.

Showing 1-2 of 2 results.

A373451 Number T(n,k) of (binary) heaps of length n whose element set equals [k]; triangle T(n,k), n>=0, 0<=k<=n, read by rows.

Original entry on oeis.org

1, 0, 1, 0, 1, 1, 0, 1, 3, 2, 0, 1, 5, 7, 3, 0, 1, 9, 23, 23, 8, 0, 1, 14, 55, 92, 70, 20, 0, 1, 24, 147, 386, 502, 320, 80, 0, 1, 34, 281, 1004, 1861, 1880, 985, 210, 0, 1, 54, 633, 3128, 8113, 12008, 10237, 4690, 896, 0, 1, 79, 1241, 8039, 27456, 54900, 66730, 48650, 19600, 3360
Offset: 0

Views

Author

Alois P. Heinz, Jun 05 2024

Keywords

Comments

These heaps may contain repeated elements. Their element sets are gap-free and contain 1 (if nonempty).
T(n,k) is defined for n,k >= 0. The triangle contains only the terms with k<=n. T(n,k) = 0 for k>n.

Examples

			T(4,1) = 1: 1111.
T(4,2) = 5: 2111, 2121, 2211, 2212, 2221.
T(4,3) = 7: 3121, 3211, 3212, 3221, 3231, 3312, 3321.
T(4,4) = 3: 4231, 4312, 4321.
(The examples use max-heaps.)
Triangle T(n,k) begins:
  1;
  0, 1;
  0, 1,  1;
  0, 1,  3,   2;
  0, 1,  5,   7,    3;
  0, 1,  9,  23,   23,    8;
  0, 1, 14,  55,   92,   70,    20;
  0, 1, 24, 147,  386,  502,   320,    80;
  0, 1, 34, 281, 1004, 1861,  1880,   985,  210;
  0, 1, 54, 633, 3128, 8113, 12008, 10237, 4690, 896;
  ...
		

Crossrefs

Columns k=0-4 give A000007, A057427, A091980(n+1)-2, A376962, A376963.
Row sums give A373452.
Row maxima give A373608.
Main diagonal gives A056971.
First lower diagonal gives A373496.
T(2n,n) gives A373500.
Antidiagonal sums give A373632.
Antidiagonal maxima give A373897.

Programs

  • Maple
    b:= proc(n, k) option remember; `if`(n=0, 1,
         (g-> (f-> add(b(f, j)*b(n-1-f, j), j=1..k)
                 )(min(g-1, n-g/2)))(2^ilog2(n)))
        end:
    T:= (n, k)-> add(binomial(k, j)*(-1)^j*b(n, k-j), j=0..k):
    seq(seq(T(n, k), k=0..n), n=0..12);
  • Mathematica
    b[n_, k_] := b[n, k] = If[n == 0, 1,
       Function[g, Function[f, Sum[b[f, j]*b[n-1-f, j], {j, 1, k}]][
          Min[g-1, n-g/2]]][2^(Length@IntegerDigits[n, 2]-1)]];
    T[n_, k_] := Sum[Binomial[k, j]*(-1)^j*b[n, k-j], {j, 0, k}];
    Table[Table[T[n, k], {k, 0, n}], {n, 0, 12}] // Flatten (* Jean-François Alcover, Sep 20 2024, after Alois P. Heinz *)

Formula

T(n,k) = Sum_{j=0..k} binomial(k,j) * (-1)^j * A373449(n,k-j).
Sum_{k=0..n} (-1)^k * T(n,n-k) = A019590(n+1).

A373897 Number of (binary) heaps of length n-k whose element set equals [k], where k is chosen so as to maximize this number.

Original entry on oeis.org

1, 0, 1, 1, 1, 3, 5, 9, 23, 55, 147, 386, 1004, 3128, 8113, 27456, 111574, 321433, 1150885, 4888981, 17841912, 80566518, 332583340, 1188065665, 5473922425, 21725492503, 99894124075, 548452369329, 2185136109838, 11339193480666, 59140581278157, 288137011157366
Offset: 0

Views

Author

Alois P. Heinz, Jun 21 2024

Keywords

Comments

These heaps may contain repeated elements. Their element sets are gap-free and contain 1 (if nonempty).

Examples

			a(6) = 5: 2111, 2121, 2211, 2212, 2221 (with k=2).
a(7) = 9: 21111, 21211, 22111, 22112, 22121, 22122, 22211, 22212, 22221 (with k=2).
a(8) = 23: 31211, 32111, 32112, 32121, 32122, 32211, 32212, 32221, 32311, 32312, 32321, 33112, 33121, 33122, 33123, 33132, 33211, 33212, 33213, 33221, 33231, 33312, 33321 (with k=3).
(The examples use max-heaps.)
		

Crossrefs

Antidiagonal maxima of A373451.
Cf. A373632.

Programs

  • Maple
    b:= proc(n, k) option remember; `if`(n=0, 1,
         (g-> (f-> add(b(f, j)*b(n-1-f, j), j=1..k)
                 )(min(g-1, n-g/2)))(2^ilog2(n)))
        end:
    T:= (n, k)-> add(binomial(k, j)*(-1)^j*b(n, k-j), j=0..k):
    a:= n-> max(seq(T(n-j, j), j=0..n/2)):
    seq(a(n), n=0..31);

Formula

a(n) = max({ A373451(n-j,j) : 0 <= j <= floor(n/2) }).
Showing 1-2 of 2 results.