TOPICS
Search

Stack-Sortable Permutation


A stack-sortable permutation is a permutation sorted into increasing order by a single application of the deterministic stack-sorting map s. This map reads entries from left to right, pushes the next entry onto a stack if the stack is empty or that entry is smaller than the top entry, and otherwise pops the top entry into the output. After the input is exhausted, it pops the remaining entries. More generally, a t-stack-sortable permutation is sorted by at most t applications of s. For example, s(3142)=1324 and s(1324)=1234, so 3142 is 2-stack-sortable.

The stack-sortable permutations are exactly those avoiding the permutation pattern 231, and their number in the symmetric group S_n is the Catalan number C_n. The number of 2-stack-sortable permutations in the symmetric group S_n is

 2/((n+1)(2n+1))(3n; n).

Inagaki and Luo (2026) proved that the number of 2-stack-sortable permutations of {0,1,...,n} ending in 0 is the Motzkin number M_n for every n>=0.

Wen and Yan (2026) constructed a bijection between 2-stack-sortable permutations and permutations avoiding the classical permutation pattern 3142 and the vincular pattern 2-41-3, in which the entries corresponding to 4 and 1 must be adjacent. Their bijection preserves jointly the number of direct-sum components, the number of ascents, the length of the initial decreasing run, and the number of right-to-left maxima. Here a direct-sum component is a block in the unique decomposition into permutations that cannot be split into two consecutive blocks with every value of the first smaller than every value of the second.

For a positive integer n and West's stack-sorting map s:S_n->S_n, define the descent polynomial of a fiber by

 D_pi(x)=sum_(sigma in s^(-1)(pi))x^(des(sigma)),

where des(sigma) is the number of permutation descents of sigma. Defant (2026) proved that its coefficient sequence is an ultra log-concave sequence of order n-1. This does not assert that D_pi(x) is real-rooted. Defant (2026) credits AxiomProver with finding the matroid used in the proof and formalizing the results.

A different iteration is obtained by blocking consecutive occurrences of 231 in the stack (Defant and Zheng 2021). When the incoming entry followed by the top two stack entries has relative order 231, the top entry is popped before the incoming entry is pushed. Otherwise the incoming entry is pushed directly. The stack is read from top to bottom and is emptied after the input is exhausted. The periodic permutations are exactly those avoiding both classical patterns 132 and 231. Correia (2026) reports an AI-assisted formalized construction showing that for every n>=8, some length-n permutation requires at least n+3 passes to enter this periodic set, with the input counted as time zero.


See also

Catalan Number, Motzkin Number, Permutation, Permutation Pattern

Explore with Wolfram|Alpha

References

Bousquet-Mélou, M. "Sorted and/or Sortable Permutations." Disc. Math. 225, 25-50, 2000. https://doi.org/10.1016/S0012-365X(00)00146-1.Correia, T. "A Uniform Lower Bound on the Transient Length of the Consecutive-231 Stack Map." Palomar Registry, Nov. 28, 2026. https://palomar-registry.org/entry.html?id=PALOMAR-2026-11-28-000075&version=1.Defant, C. "Log-Concavity in Narayana Transforms and Stack-Sorting Fibers." 10 Nov 2026. https://arxiv.org/abs/2611.13479.Defant, C. and Zheng, K. "Stack-Sorting with Consecutive-Pattern-Avoiding Stacks." Adv. Appl. Math. 128, 102192, 2021. https://doi.org/10.1016/j.aam.2021.102192.Inagaki, R. and Luo, M. "Motzkin Numbers Count 2-Stack-Sortable Permutations Ending in Their Least Entry." 2 Oct 2026. https://arxiv.org/abs/2610.02756.Wen, Y. and Yan, S. H. F. "On a Conjecture Concerning Two-Stack Sortable Permutations." 21 Oct 2026. https://arxiv.org/abs/2610.29115.

Cite this as:

Weisstein, Eric W. "Stack-Sortable Permutation." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/Stack-SortablePermutation.html

Subject classifications