OFFSET
4,1
LINKS
Alois P. Heinz, Table of n, a(n) for n = 4..2614
Eric Weisstein's World of Mathematics, Heap
Wikipedia, Binary heap
EXAMPLE
a(4) = 3: 4231, 4312, 4321.
a(5) = 23: 42311, 42312, 42321, 43112, 43121, 43122, 43123, 43132, 43211, 43212, 43213, 43221, 43231, 43312, 43321, 43412, 43421, 44123, 44132, 44213, 44231, 44312, 44321.
(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))(4):
seq(a(n), n=4..35);
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Oct 10 2024
STATUS
approved