OFFSET
1,2
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 decreasing run in a permutation is a maximal contiguous subsequence that is strictly decreasing. For example, in the permutation (3,1,4,2) the decreasing runs are (3,1) and (4,2).
LINKS
Manolopoulos Panagiotis, Python program.
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.
EXAMPLE
For n=4, the heapable permutations are:
(1,2,3,4): runs (1),(2),(3),(4) => 4 decreasing runs.
(1,3,2,4): runs (1), (3,2), (4) => 3 decreasing runs.
(1,2,4,3): runs (1),(2), (4,3) => 3 decreasing runs.
(1,4,2,3): runs (1), (4,2), (3) => 3 decreasing runs.
(1,3,4,2): runs (1),(3),(4,2) => 3 decreasing run.
So among the 5 heapable permutations of length 4:
1 permutations have 4 decreasing run,
4 permutations have 3 decreasing runs,
for a total of 16 decreasing runs.
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Manolopoulos Panagiotis, Sep 26 2025
EXTENSIONS
a(11)-a(15) from Sean A. Irvine, Oct 06 2025
a(16) from Sean A. Irvine, Oct 14 2025
STATUS
approved
