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 231-pattern in a heapable permutation p=(p1,p2..pn) is a triad of indices i<j<k where pk<pi<pj.
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
EXAMPLE
For n=4 the heapable permutations are:
(1,2,3,4): no 231 patterns.
(1,3,2,4): no 231 patterns.
(1,2,4,3): no 231 patterns.
(1,3,4,2): (3,4,2) => 1 231 pattern.
(1,4,2,3): no 231 patterns.
So among the 5 heapable permutations of length 4:
4 permutation have 0 231 patterns,
1 permutation has 1 231 pattern,
for a total of 1 132 patterns.
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Manolopoulos Panagiotis, Dec 19 2025
EXTENSIONS
a(11)-a(15) from Sean A. Irvine, Jan 05 2026
STATUS
approved
