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 A372643 #17 Feb 16 2025 08:34:06 %S A372643 0,0,1,2,4,6,13,22,36,54,99,164,260,400,692,1146,1730,2638,4358,7148, %T A372643 10788,16716,27168,44692,65630,100736,159851,261156,385740,599704, %U A372643 946368,1551686,2245014,3455650,5364990,8743620,12757292,19869332,30818816,50429524 %N A372643 Number of defective (binary) heaps on n elements from the set {0,1} where exactly one ancestor-successor pair does not have the correct order. %H A372643 Alois P. Heinz, <a href="/A372643/b372643.txt">Table of n, a(n) for n = 0..5636</a> %H A372643 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Heap.html">Heap</a> %H A372643 Wikipedia, <a href="https://en.wikipedia.org/wiki/Binary_heap">Binary heap</a> %F A372643 a(n) = A372640(n,1). %e A372643 a(2) = 1: 01. %e A372643 a(3) = 2: 001, 010. %e A372643 a(4) = 4: 0010, 0100, 1001, 1011. %e A372643 a(5) = 6: 00100, 01000, 10001, 10010, 10101, 10110. %e A372643 a(6) = 13: 001000, 010000, 100001, 100010, 100100, 101010, 101011, 101100, 101101, 110001, 110011, 110101, 110111. %e A372643 (The examples use max-heaps.) %p A372643 b:= proc(n, t) option remember; convert(series(`if`(n=0, 1, (g-> %p A372643 (f-> expand(b(f, t)*b(n-1-f, t)*x^t+b(f, t+1)*b(n-1-f, t+1) %p A372643 ))(min(g-1, n-g/2)))(2^ilog2(n))),x,2), polynom) %p A372643 end: %p A372643 a:= n-> coeff(b(n, 0),x,1): %p A372643 seq(a(n), n=0..39); %t A372643 b[n_, t_] := b[n, t] = If[n == 0, 1, Function[g, Function [f, %t A372643 Expand[b[f, t]*b[n - 1 - f, t]*x^t + b[f, t + 1]*b[n - 1 - f, t + 1]]][ %t A372643 Min[g - 1, n - g/2]]][2^(Length@IntegerDigits[n, 2] - 1)]]; %t A372643 a[n_] := Coefficient[b[n, 0], x, 1]; %t A372643 Table[a[n], {n, 0, 39}] (* _Jean-François Alcover_, May 09 2024, after _Alois P. Heinz_ *) %Y A372643 Column k=1 of A372640. %Y A372643 Cf. A323957, A372628. %K A372643 nonn %O A372643 0,4 %A A372643 _Alois P. Heinz_, May 08 2024