OFFSET
0,3
COMMENTS
These heaps may contain repeated elements.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..444
Eric Weisstein's World of Mathematics, Heap
Wikipedia, Binary heap
EXAMPLE
a(0) = 1: the empty heap.
a(1) = 1: 1.
a(2) = 3: 11, 21, 22.
a(3) = 14: 111, 211, 212, 221, 222, 311, 312, 313, 321, 322, 323, 331, 332, 333.
(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-> b(n$2):
seq(a(n), n=0..21);
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Jun 05 2024
STATUS
approved