OFFSET
0,4
COMMENTS
In a min-heap on (n+1) distinct elements only n elements can change places, since the first element is determined to be the minimum. a(n) gives the number of all possibilities divided by the number of legal possibilities to do this.
Is this the sequence mentioned on page 360 of Motzkin (1948)? - N. J. A. Sloane, Jul 04 2015
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1000
T. Motzkin, The hypersurface cross ratio, Bull. Amer. Math. Soc., 51 (1945), 976-984.
T. S. Motzkin, Relations between hypersurface cross ratios and a combinatorial formula for partitions of a polygon, for permanent preponderance and for non-associative products, Bull. Amer. Math. Soc., 54 (1948), 352-360.
Eric Weisstein's World of Mathematics, Heap
Wikipedia, Binary heap
EXAMPLE
a(4) = 3 because 3 = 24/8 and there are 4! = 24 permutations on 4 elements and 8 min-heaps on 5 elements, namely (0,1,2,3,4), (0,1,2,4,3), (0,1,3,2,4), (0,1,3,4,2), (0,1,4,2,3), (0,1,4,3,2), (0,2,1,3,4), and (0,2,1,4,3)). In every (min-) heap, the element at position i has to be larger than the element at position floor(i/2) for all i=2..n. The minimum is always found at position 1.
MAPLE
h:= proc(n) option remember; `if`(n=0, 1, (b-> (f->
h(f)*n*h(n-1-f))(min(b-1, n-b/2)))(2^ilog2(n)))
end:
a:= n-> h(n+1)/(n+1):
seq(a(n), n=0..50);
MATHEMATICA
aa[n_] := aa[n] = Module[{b, nl}, If[n<2, 1, b = 2^Floor[Log[2, n]]; nl = Min[b-1, n-b/2]; n*aa[nl]*aa[n-1-nl]]]; a[n_] := aa[n+1]/(n+1); Table[a[i], {i, 0, 50}] (* Jean-François Alcover, Mar 05 2014, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Nov 22 2007
STATUS
approved