%I #25 Jan 26 2026 16:53:28
%S 1,1,1,2,5,14,3,42,18,11,132,82,84,27,22,11,1,429,339,456,256,243,143,
%T 124,61,43,28,4,1430,1341,2158,1638,1766,1227,1321,931,749,610,466,
%U 295,198,166,131,28,21,15,4,4862,5187,9511,8837,10588,8516,9954,8164
%N Triangle read by rows: T(n,k) = number of heapable permutations of length n with exactly k 321 patterns.
%C 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.
%C 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).
%H Sean A. Irvine, <a href="/A391971/b391971.txt">Table of n, a(n) for n = 0..556</a>
%H Benjamin Chen, Michael Cho, Mario Tutuncu-Macias, and Tony Tzolov, <a href="https://doi.org/10.1016/j.dam.2023.01.025">Efficient methods of calculating the number of heapable permutations</a>, Discrete Applied Mathematics Volume 331, 31 May 2023, Pages 126-137.
%H Manolopoulos Panagiotis, <a href="/A391971/a391971.py.txt">Python Program</a>.
%e Triangle begins:
%e 1
%e 1
%e 1
%e 2
%e 5
%e 14, 3
%e 42, 18, 11
%e 132, 82, 84, 27, 22, 11, 1
%e 429, 339, 456, 256, 243, 143, 124, 61, 43, 28, 4
%Y Cf. A336282 (heapable permutations), A391776 (triangle 231 patterns), A391697 (total 213 patterns), A391777 (total 231 patterns).
%K nonn,tabf
%O 0,4
%A _Manolopoulos Panagiotis_, Dec 24 2025
%E Offset corrected and more terms from _Sean A. Irvine_, Jan 26 2026