A178009
Number of permutations of 1..n with no element e[i>=2]
Original entry on oeis.org
1, 1, 1, 2, 6, 24, 60, 240, 1260, 8064, 36288, 241920, 1995840, 19160064, 124540416, 1162377216, 13076743680, 167382319104, 1422749712384, 17072996548608, 243290200817664, 3892643213082624, 34060628114472960, 428190753439088640, 6463004184721244160
Offset: 0
A309052
Total number of 1's in all (binary) max-heaps on n elements from the set {0,1}.
Original entry on oeis.org
0, 1, 3, 8, 15, 31, 54, 105, 166, 298, 478, 863, 1307, 2247, 3500, 6136, 9032, 15084, 23039, 39599, 57955, 96019, 145627, 248223, 357650, 583274, 875459, 1476754, 2131618, 3476550, 5210521, 8766473, 12498445, 20138409, 29952394, 50020414, 71658602, 115850282
Offset: 0
a(4) = 15 = 0+1+2+2+3+3+4, the total number of 1's in 0000, 1000, 1010, 1100, 1101, 1110, 1111.
-
b:= proc(n) option remember; `if`(n=0, 1, (g-> (f-> expand(
1+x*b(f)*b(n-1-f)))(min(g-1, n-g/2)))(2^ilog2(n)))
end:
a:= n-> subs(x=1, diff(b(n), x)):
seq(a(n), n=0..40);
-
b[n_][x_] := b[n][x] = If[n == 0, 1, Function[g, Function[f, Expand[1 + x b[f][x] b[n - 1 - f][x]]][Min[g - 1, n - g/2]]][2^(Length[IntegerDigits[ n, 2]] - 1)]];
a[n_] := b[n]'[1];
a /@ Range[0, 40] (* Jean-François Alcover, Apr 22 2021, after Alois P. Heinz *)
A323957
Number of defective (binary) heaps on n elements with exactly one defect.
Original entry on oeis.org
0, 1, 2, 9, 28, 90, 360, 1526, 7616, 32460, 190800, 947760, 6382464, 37065600, 296524800, 1812861600, 15283107840, 105015593280, 1017540576000, 7304720544000, 74472335308800, 629300251008000, 7429184791142400, 62417372203929600, 746041213793075200
Offset: 1
a(2) = 1: 12.
a(3) = 2: 213, 231.
a(4) = 9: 2413, 3124, 3214, 3241, 3412, 3421, 4123, 4132, 4213.
a(5) = 28: 25134, 25143, 35124, 35142, 35214, 35241, 42315, 42351, 43125, 43152, 43215, 43251, 43512, 43521, 45123, 45132, 45213, 45231, 45312, 45321, 52314, 52341, 52413, 52431, 53124, 53142, 53214, 53241.
a(6) = 90: 362451, 362541, 436125, 436215, ..., 652314, 652413, 653124, 653214.
(The examples use max-heaps.)
-
b:= proc(u, o) option remember; local n, g, l; n:= u+o;
if n=0 then 1
else g:= 2^ilog2(n); l:= min(g-1, n-g/2); expand(
add(add(binomial(j-1, i)*binomial(n-j, l-i)*
b(i, l-i)*b(j-1-i, n-l-j+i), i=0..min(j-1, l)), j=1..u)+
add(add(binomial(j-1, i)*binomial(n-j, l-i)*
b(l-i, i)*b(n-l-j+i, j-1-i), i=0..min(j-1, l)), j=1..o)*x)
fi
end:
a:= n-> coeff(b(n, 0), x, 1):
seq(a(n), n=1..25);
-
b[u_, o_] := b[u, o] = Module[{n = u+o, g, l}, If[n == 0, 1,
g = 2^(Length[IntegerDigits[n, 2]] - 1);
l = Min[g - 1, n - g/2]; Expand[
Sum[ Sum[Binomial[j - 1, i]*Binomial[n - j, l - i]*
b[i, l-i]*b[j-1-i, n-l-j+i], {i, 0, Min[j-1, l]}], {j, 1, u}] +
Sum[Sum[Binomial[j - 1, i]*Binomial[n - j, l - i]*
b[l-i, i]*b[n-l-j+i, j-1-i], {i, 0, Min[j-1, l]}], {j, 1, o}]*x]]];
a[n_] := Coefficient[b[n, 0], x, 1];
Array[a, 25] (* Jean-François Alcover, Apr 22 2021, after Alois P. Heinz *)
A373452
Number of (binary) heaps of length n whose element set equals [k] (for some k <= n).
Original entry on oeis.org
1, 1, 2, 6, 16, 64, 252, 1460, 6256, 39760, 230056, 1920152, 12154416, 113087888, 916563592, 10586707896, 80444848064, 898922718272, 8634371968224, 117894609062176, 1160052513737280, 16638593775310528, 200744153681516384, 3415784055462112160, 38542918215425934624
Offset: 0
a(0) = 1: the empty heap.
a(1) = 1: 1.
a(2) = 2: 11, 21.
a(3) = 6: 111, 211, 212, 221, 312, 321.
a(4) = 16: 1111, 2111, 2121, 2211, 2212, 2221, 3121, 3211, 3212, 3221, 3231, 3312, 3321, 4231, 4312, 4321.
(The examples use max-heaps.)
-
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-> add(add(binomial(k, j)*(-1)^j*b(n, k-j), j=0..k), k=0..n):
seq(a(n), n=0..24);
-
b[n_, k_] := b[n, k] = If[n == 0, 1, Function[g, Function[f, Sum[b[f, j]*b[n - 1 - f, j], {j, 1, k}]][Min[g - 1, n - g/2]]][2^(Length@IntegerDigits[n, 2] - 1)]];
T[n_, k_] := Sum[Binomial[k, j]*(-1)^j*b[n, k - j], {j, 0, k}];
a[n_] := Sum[T[n, k], {k, 0, n}];
Table[a[n], {n, 0, 24}] (* Jean-François Alcover, Sep 24 2024, after Alois P. Heinz *)
A133385
Number of permutations of n elements divided by the number of (binary) heaps on n+1 elements.
Original entry on oeis.org
1, 1, 1, 2, 3, 6, 9, 24, 45, 108, 189, 504, 945, 2268, 3969, 12096, 25515, 68040, 130977, 381024, 773955, 2000376, 3750705, 11430720, 24111675, 64297800, 123773265, 360067680, 731387475, 1890355320, 3544416225, 11522165760, 25823603925, 72913705200, 148156598205
Offset: 0
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.
- Alois P. Heinz, Table of n, a(n) for n = 0..2450
- 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
-
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);
-
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 *)
A178010
Number of permutations of 1..n with no element e[i>=2]
Original entry on oeis.org
1, 1, 1, 2, 6, 24, 120, 360, 1680, 10080, 72576, 604800, 3326400, 26611200, 259459200, 2905943040, 36324288000, 290594304000, 3293402112000, 44460928512000, 675806113382400, 11263435223040000, 118266069841920000, 1734569024348160000, 29921315670005760000
Offset: 0
A178011
Number of permutations of 1..n with no element e[i>=2]
Original entry on oeis.org
1, 1, 1, 2, 6, 24, 120, 720, 2520, 13440, 90720, 725760, 6652800, 68428800, 444787200, 4151347200, 46702656000, 597793996800, 8468748288000, 130660687872000, 1241276534784000, 16550353797120000, 260668072304640000, 4587758072561664000, 87932029724098560000
Offset: 0
A309051
Total number of 0's in all (binary) max-heaps on n elements from the set {0,1}.
Original entry on oeis.org
0, 1, 3, 7, 13, 24, 42, 77, 122, 206, 332, 578, 889, 1484, 2338, 4019, 5960, 9685, 14887, 25134, 37225, 60704, 92919, 156646, 227302, 364551, 550329, 917822, 1337358, 2158150, 3258779, 5441757, 7800755, 12412461, 18546566, 30708486, 44327782, 71090442
Offset: 0
a(4) = 13 = 4+3+2+2+1+1+0, the total number of 0's in 0000, 1000, 1010, 1100, 1101, 1110, 1111.
-
b:= proc(n) option remember; `if`(n=0, 1, (g-> (f-> expand(
x^n+b(f)*b(n-1-f)))(min(g-1, n-g/2)))(2^ilog2(n)))
end:
a:= n-> subs(x=1, diff(b(n), x)):
seq(a(n), n=0..40);
-
b[n_][x_] := b[n][x] = If[n == 0, 1, Function[g, Function[f, Expand[x^n + b[f][x] b[n - 1 - f][x]]][Min[g - 1, n - g/2]]][2^(Length[IntegerDigits[ n, 2]] - 1)]];
a[n_] := b[n]'[1];
a /@ Range[0, 40] (* Jean-François Alcover, Apr 22 2021, after Alois P. Heinz *)
A373450
Number of (binary) heaps of length n whose element set is a subset of [n].
Original entry on oeis.org
1, 1, 3, 14, 65, 448, 3136, 32028, 251922, 2891801, 30684797, 464651863, 5434037232, 92246217970, 1379368317328, 29135744093948, 414052904722966, 8546218817446727, 152935671938144301, 3857215760145872627, 70913916905782150177, 1881992311219764068420
Offset: 0
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.)
Cf.
A056971 (distinct elements),
A373452 (gap-free element sets including 1).
-
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);
A246747
The number of binary heaps on n elements whose breadth-first search reading word avoids 231.
Original entry on oeis.org
1, 1, 1, 2, 3, 7, 14, 37, 80, 222, 544, 1601, 4095, 12416, 33785, 105769, 293747, 935184, 2717376, 8848014, 26134254, 86210716, 262068267, 877833206, 2695238060, 9109101156, 28619396967, 97879220771, 310021153392, 1067906857449, 3440140082033, 11957123227292
Offset: 0
A heap on 4 elements is pictured in the 2nd link, and has breadth first reading word abcd. Then for n = 4 the a(4) = 3 heaps have reading words 1234, 1243, and 1324.
- Alois P. Heinz, Table of n, a(n) for n = 0..1000
- D. Levin, L. Pudwell, M. Riehl, A. Sandberg, Pattern Avoidance on k-ary Heaps, Slides of Talk, 2014.
- Manda Riehl (joint work with Derek Levin, Lara Pudwell, and Adam Sandberg), Page 92 of the Permutation Patterns 2014 Abstract Book .
- Manda Riehl, A heap on 4 elements
Comments