OFFSET
1,4
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 descent in a permutation p is an index i with 1<=i<=n-1 such that p(i)>p(i+1).
The number of descents is the count of such indices.
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=1..n-1} k*A389487(n,k+1).
EXAMPLE
For n=4, the heapable permutations are:
(1,2,3,4): no descents 0.
(1,3,2,4): descent at (3,2) 1.
(1,2,4,3): descent at (4,3) 1.
(1,4,2,3): descent at (4,2) 1.
(1,3,4,2): descent at (4,2) 1.
So the total number of descents across all 5 heapable permutations of length 4 is: 0+1+1+1+1=4.
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Manolopoulos Panagiotis, Oct 21 2025
EXTENSIONS
a(11)-a(16) from Sean A. Irvine, Oct 26 2025
STATUS
approved
