OFFSET
0,6
COMMENTS
A permutation of [1..n] is heapable if it can be inserted, one element at a time, into a binary min-heap without violating the heap property.
A 321-pattern in a heapable permutation p=(p(1),p(2),...,p(n)) is a triad of indices x<y<z where p(z) < p(y) < p(x).
LINKS
Benjamin Chen, Michael Cho, Mario Tutuncu-Macias, and Tony Tzolov, Efficient methods of calculating the number of heapable permutations, Discrete Applied Mathematics Volume 331, 31 May 2023, Pages 126-137.
Manolopoulos Panagiotis, Python program
FORMULA
a(n) = Sum_{k>=0} k*A391971(n,k).
EXAMPLE
For n=4 the heapable permutations are:
(1,2,3,4): no 321 patterns.
(1,3,2,4): no 321 patterns.
(1,2,4,3): no 321 patterns.
(1,3,4,2): no 321 patterns.
(1,4,2,3): no 321 patterns.
So among the 5 heapable permutations of length 4:
5 permutation have 0 321 patterns, for a total of 0 321 patterns.
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Manolopoulos Panagiotis, Jan 15 2026
EXTENSIONS
a(11)-a(15) from Sean A. Irvine, Jan 26 2026
STATUS
approved
