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 A372641 #15 Feb 16 2025 08:34:06 %S A372641 1,0,0,0,0,1,2,2,9,11,36,71,151,306,591,1228,2469,4966,10025,19591, %T A372641 38946,75977,148585,291027,579981,1152385,2280696,4470814,8817933, %U A372641 17244969,33819425,65976444,129933731,254791662,499516984,977417823,1914394157,3745482924 %N A372641 Number of defective (binary) heaps on n elements from the set {0,1} where exactly n ancestor-successor pairs do not have the correct order. %H A372641 Alois P. Heinz, <a href="/A372641/b372641.txt">Table of n, a(n) for n = 0..2000</a> %H A372641 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Heap.html">Heap</a> %H A372641 Wikipedia, <a href="https://en.wikipedia.org/wiki/Binary_heap">Binary heap</a> %F A372641 a(n) = A372640(n,n). %e A372641 a(5) = 1: 00111. %e A372641 a(6) = 2: 000111, 001111. %e A372641 a(7) = 2: 0011111, 0101111. %e A372641 a(8) = 9: 00010111, 00011011, 00011101, 00011110, 00101111, 00111011, 00111101, 01001111, 01011111. %e A372641 a(9) = 11: 000011101, 000011110, 001001111, 001010011, 001101111, 001110011, 001111101, 001111110, 010001111, 010111111, 011011111. %e A372641 (The examples use max-heaps.) %p A372641 b:= proc(n, t) option remember; `if`(n=0, 1, (g-> (f-> %p A372641 expand(b(f, t)*b(n-1-f, t)*x^t+b(f, t+1)*b(n-1-f, t+1) %p A372641 ))(min(g-1, n-g/2)))(2^ilog2(n))) %p A372641 end: %p A372641 a:= n-> coeff(b(n, 0),x,n): %p A372641 seq(a(n), n=0..37); %t A372641 b[n_, t_] := b[n, t] = If[n == 0, 1, Function[g, Function [f, %t A372641 Expand[b[f, t]*b[n-1-f, t]*x^t + b[f, t+1]*b[n-1-f, t+1]]][ %t A372641 Min[g-1, n-g/2]]][2^(Length@IntegerDigits[n, 2]-1)]]; %t A372641 a[n_] := Coefficient[b[n, 0], x, n]; %t A372641 Table[a[n], {n, 0, 37}] (* _Jean-François Alcover_, May 09 2024, after _Alois P. Heinz_ *) %Y A372641 Main diagonal of A372640. %K A372641 nonn %O A372641 0,7 %A A372641 _Alois P. Heinz_, May 08 2024