login
A387977
Triangle T(n,k) read by rows, where T(n,k) = number of heapable permutations of length n with exactly k inversions.
2
1, 1, 0, 1, 1, 0, 0, 1, 2, 2, 0, 0, 0, 0, 1, 3, 5, 5, 3, 0, 0, 0, 0, 0, 0, 1, 4, 9, 14, 17, 15, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 5, 14, 28, 45, 60, 67, 61, 45, 24, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 6, 20, 48, 93, 153, 220, 279, 314, 312, 271, 202, 123, 58, 22, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
OFFSET
1,9
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.
An inversion in a permutation p of length n is a pair of indices (i,j) with i<j such that p(i)>p(j).
The total number of inversions is the number of such pairs.
LINKS
Sean A. Irvine, Table of n, a(n) for n = 1..575 (rows 1..15 flattened, rows 1..10 from Manolopoulos Panagiotis)
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
Triangle begins:
1
1, 0
1, 1, 0, 0
1, 2, 2, 0, 0, 0, 0
1, 3, 5, 5, 3, 0, 0, 0, 0, 0, 0
1, 4, 9, 14, 17, 15, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0
1, 5, 14, 28, 45, 60, 67, 61, 45, 24, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
1, 6, 20, 48, 93, 153, 220, 279, 314, 312, 271, 202, 123, 58, 22, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
CROSSREFS
Cf. A336282 (number of heapable permutations of length n), A386382 (total runs in heapable permutations), A387955 (sum of major indices), A389496 (triangle of major indices).
Sequence in context: A236109 A279279 A035447 * A227188 A354107 A037863
KEYWORD
nonn,tabf
AUTHOR
STATUS
approved