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.
%I A372640 #26 Feb 16 2025 08:34:06 %S A372640 1,2,3,1,5,2,1,7,4,3,2,11,6,7,5,2,1,16,13,12,8,10,3,2,26,22,23,14,21, %T A372640 10,9,2,1,36,36,39,33,33,28,26,13,9,2,1,56,54,67,61,60,59,56,37,34,11, %U A372640 13,2,2,81,99,111,96,117,112,107,96,76,53,36,20,14,4,2 %N A372640 Number T(n,k) of defective (binary) heaps on n elements from the set {0,1} where k ancestor-successor pairs do not have the correct order; triangle T(n,k), n>=0, read by rows. %C A372640 T(n,k) is the number of bit vectors v of length n having exactly k pairs (i,j) in {1,...,n} X {1,...,floor(log_2(i))} such that v[i] > v[floor(i/2^j)]. %C A372640 T(n,0) counts perfect (binary) heaps on n elements from the set {0,1}. %C A372640 T(n,k) is defined for all n>=0 and k>=0. The triangle displays only positive terms. All other terms are zero. %H A372640 Alois P. Heinz, <a href="/A372640/b372640.txt">Rows n = 0..112, flattened</a> %H A372640 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Heap.html">Heap</a> %H A372640 Wikipedia, <a href="https://en.wikipedia.org/wiki/Binary_heap">Binary heap</a> %e A372640 T(4,0) = 7: 0000, 1000, 1010, 1100, 1101, 1110, 1111. %e A372640 T(4,1) = 4: 0010, 0100, 1001, 1011. %e A372640 T(4,2) = 3: 0001, 0101, 0110. %e A372640 T(4,3) = 2: 0011, 0111. %e A372640 (The examples use max-heaps.) %e A372640 Triangle T(n,k) begins: %e A372640 1; %e A372640 2; %e A372640 3, 1; %e A372640 5, 2, 1; %e A372640 7, 4, 3, 2; %e A372640 11, 6, 7, 5, 2, 1; %e A372640 16, 13, 12, 8, 10, 3, 2; %e A372640 26, 22, 23, 14, 21, 10, 9, 2, 1; %e A372640 36, 36, 39, 33, 33, 28, 26, 13, 9, 2, 1; %e A372640 56, 54, 67, 61, 60, 59, 56, 37, 34, 11, 13, 2, 2; %e A372640 81, 99, 111, 96, 117, 112, 107, 96, 76, 53, 36, 20, 14, 4, 2; %e A372640 ... %p A372640 b:= proc(n, t) option remember; `if`(n=0, 1, (g-> (f-> %p A372640 expand(b(f, t)*b(n-1-f, t)*x^t+b(f, t+1)*b(n-1-f, t+1) %p A372640 ))(min(g-1, n-g/2)))(2^ilog2(n))) %p A372640 end: %p A372640 T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0)): %p A372640 seq(T(n), n=0..14); %t A372640 b[n_, t_] := b[n, t] = If[n == 0, 1, Function[g, Function [f, %t A372640 Expand[b[f, t]*b[n-1-f, t]*x^t + b[f, t+1]*b[n-1 - f, t+1]]][ %t A372640 Min[g-1, n-g/2]]][2^(Length@IntegerDigits[n, 2]-1)]]; %t A372640 T[n_] := CoefficientList[b[n, 0], x]; %t A372640 Table[T[n], {n, 0, 14}] // Flatten (* _Jean-François Alcover_, May 09 2024, after _Alois P. Heinz_ *) %Y A372640 Columns k=0-1 give: A091980(n+1), A372643. %Y A372640 Row sums give A000079. %Y A372640 Main diagonal gives A372641. %Y A372640 T(2,n) gives A372642. %Y A372640 Cf. A306393, A370484. %K A372640 nonn,tabf %O A372640 0,2 %A A372640 _Alois P. Heinz_, May 08 2024