OFFSET
3,1
LINKS
Alois P. Heinz, Table of n, a(n) for n = 3..3404
Eric Weisstein's World of Mathematics, Heap
Wikipedia, Binary heap
EXAMPLE
a(4) = 7: 3121, 3211, 3212, 3221, 3231, 3312, 3321.
a(5) = 23: 31211, 32111, 32112, 32121, 32122, 32211, 32212, 32221, 32311, 32312, 32321, 33112, 33121, 33122, 33123, 33132, 33211, 33212, 33213, 33221, 33231, 33312, 33321.
(The examples use max-heaps.)
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:
a:= n-> (k-> add(binomial(k, j)*(-1)^j*b(n, k-j), j=0..k))(3):
seq(a(n), n=3..35);
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Oct 10 2024
STATUS
approved