login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A373452 Number of (binary) heaps of length n whose element set equals [k] (for some k <= n). 4

%I #24 Jun 07 2024 09:13:52

%S 1,1,2,6,16,64,252,1460,6256,39760,230056,1920152,12154416,113087888,

%T 916563592,10586707896,80444848064,898922718272,8634371968224,

%U 117894609062176,1160052513737280,16638593775310528,200744153681516384,3415784055462112160,38542918215425934624

%N Number of (binary) heaps of length n whose element set equals [k] (for some k <= n).

%C These heaps may contain repeated elements. Their element sets are gap-free and contain 1 (if nonempty).

%H Alois P. Heinz, <a href="/A373452/b373452.txt">Table of n, a(n) for n = 0..495</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Heap.html">Heap</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Binary_heap">Binary heap</a>

%e a(0) = 1: the empty heap.

%e a(1) = 1: 1.

%e a(2) = 2: 11, 21.

%e a(3) = 6: 111, 211, 212, 221, 312, 321.

%e a(4) = 16: 1111, 2111, 2121, 2211, 2212, 2221, 3121, 3211, 3212, 3221, 3231, 3312, 3321, 4231, 4312, 4321.

%e (The examples use max-heaps.)

%p b:= proc(n, k) option remember; `if`(n=0, 1,

%p (g-> (f-> add(b(f, j)*b(n-1-f, j), j=1..k)

%p )(min(g-1, n-g/2)))(2^ilog2(n)))

%p end:

%p a:= n-> add(add(binomial(k, j)*(-1)^j*b(n, k-j), j=0..k), k=0..n):

%p seq(a(n), n=0..24);

%Y Row sums of A373451.

%Y Cf. A000670, A056971 (distinct elements), A373450.

%K nonn

%O 0,3

%A _Alois P. Heinz_, Jun 05 2024

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 17 14:54 EDT 2024. Contains 375987 sequences. (Running on oeis4.)