Enumerative conjecture for minimally-sorted permutations

About 2 years old · traced to

Let Mn\mathfrak{M}_n be the set of minimally-sorted permutations under s123,132s_{123,132}. Enumerative conjecture. For every positive integer nn,

∣M2n∣=(n+1)∣M2n−1∣.\lvert\mathfrak{M}_{2n}\rvert=(n+1)\lvert\mathfrak{M}_{2n-1}\rvert.

This gives a recurrence between the numbers of minimally-sorted permutations of consecutive odd and even lengths; the source says it was computationally verified for n≤6n\leq6.

References

Primary source

Owen Zhang, “The Order of the (123, 132)-Avoiding Stack Sort”, arXiv:2405.01854 (2024).

Progress summary

Refreshed
Claimed solved

A posted argument claims a complete proof of the recurrence, but no independent verification has been found, so the conjecture remains unconfirmed.

Owen Zhang introduced the minimally-sorted permutations and stated the enumerative conjecture in 2024: ∣M2n∣=(n+1)∣M2n−1∣\lvert\mathfrak{M}_{2n}\rvert=(n+1)\lvert\mathfrak{M}_{2n-1}\rvert. His paper reports computational verification through n≤6n\leq6, but presents no proof.

Known results

  • Zhang, 2024: established the iteration order ord⁡s123,132(Sn)=2⌊n−12⌋\operatorname{ord}_{s_{123,132}}(S_n)=2\left\lfloor\frac{n-1}{2}\right\rfloor and introduced Mn\mathfrak{M}_n; the recurrence itself remained conjectural.

Posted attempt

A detailed posted argument claims a complete bijective proof: deleting the final entry gives a map from M2n\mathfrak{M}_{2n} to M2n−1\mathfrak{M}_{2n-1}, with exactly n+1n+1 inverse extensions. The argument has not been independently verified.

Current status (as of August 2026): the recurrence is computationally verified for n≤6n\leq6, while the complete posted proof remains unverified and the conjecture is therefore open.

Sources

Solutions 1

ProofThis solution needs a summarySee full solutionHide full solution

A recurrence for minimally sorted permutations

Let S=s123,132S=s_{123,132} be the greedy stack map: read the input from left to right, pushing the next entry whenever the stack, read from top to bottom, avoids 123123 and 132132, and otherwise popping its top entry to the output. Flush the stack when the input is exhausted. Let MN\mathfrak M_N be the permutations of [N][N] taking the maximum number of iterations to reach a periodic point. We prove

∣M2n∣=(n+1)∣M2n−1∣,n≥1.\begin{gathered} |\mathfrak M_{2n}|=(n+1)|\mathfrak M_{2n-1}|,\\ n\geq1. \end{gathered}

This is Zhang, Conjecture 4.4. We use the prior results stated there as Theorems 1.1 and 1.2: writing k=⌊(N−1)/2⌋k=\lfloor(N-1)/2\rfloor, periodicity is equivalent to

πN−2i+1=i(1≤i≤k),\pi_{N-2i+1}=i\quad(1\leq i\leq k),

and the maximum time to periodicity is 2k2k. The bijection below does not assume the adjacent Conjecture 4.3.

1. Small entries and the first output

An incoming entry xx is pushed exactly when at most one entry already in the stack is larger than xx. In particular, an entry already in the stack can be popped during input processing only by an incoming smaller entry: at its own push, at most one larger entry lay below it, and the entries below it do not change while it remains in the stack. Also, the first input entry is always the last output entry.

We need the following localization fact. If the first LL entries of an input are all larger than rr, then the first L−2L-2 output entries are all larger than r+1r+1, when L≥2L\geq2. Indeed, an entry x≤r+1x\leq r+1 arriving after this prefix leaves at most one of its entries in the stack when it is pushed, so at least L−1L-1 prefix entries precede it in the output. If such an xx lies inside the prefix, it is its unique minimum. Unless it is the first input entry, it stays in the stack until the whole prefix has been read; all prefix entries other than xx and the first input entry must be output before it. If it is the first entry, it is output last.

Starting with r=0r=0 and iterating gives, for 2r<N2r<N,

St(π)j>r,if t≥r,1≤j≤N−2r.(1)\begin{gathered} S^t(\pi)_j>r,\\ \text{if }t\geq r,\quad 1\leq j\leq N-2r. \end{gathered} \tag{1}

For t>rt>r, apply the rr-pass assertion to St−r(π)S^{t-r}(\pi).

Write π(t)=St(π)\pi^{(t)}=S^t(\pi) and ft=π1(t)f_t=\pi^{(t)}_1. We claim that, for every ii with N≥2i+1N\geq2i+1, entry ii is permanently in position N−2i+1N-2i+1 by time 2i2i, and that it first becomes permanent at exactly that time if and only if

fi−1=i.(2)f_{i-1}=i. \tag{2}

For i=1i=1, an input not beginning with 11 sends 11 to the penultimate position, where it remains. An input beginning with 11 sends it to the last position and then to the penultimate position. Thus the claim holds.

Here is the tail calculation for the induction. If entries 1,…,r1,\ldots,r are in their stated positions, write the input as

W r br (r−1) br−1⋯1 b1,W\,r\,b_r\,(r-1)\,b_{r-1}\cdots1\,b_1,

where all entries of WW and all bjb_j exceed rr. Put a=W1a=W_1, and let S(W)−S(W)^- denote S(W)S(W) with its last entry aa removed. Directly processing the successive minima gives

S(W)− br r br−1 (r−1)⋯b1 1 a.(3)\begin{aligned} &S(W)^-\,b_r\,r\,b_{r-1}\,(r-1)\\ &\qquad\cdots b_1\,1\,a. \end{aligned} \tag{3}

Thus the fixed small entries remain fixed. Moreover, if

Bj(t)=πN−2j+2(t),B_j(t)=\pi^{(t)}_{N-2j+2},

the induction hypothesis and (3) give

Bj(t)=ft−j,t≥2j−1.(4)\begin{gathered} B_j(t)=f_{t-j},\\ t\geq2j-1. \end{gathered} \tag{4}

For j=1j=1 this is the first-input/last-output rule. For j≥2j\geq2, entries 1,…,j−11,\ldots,j-1 have settled by time t−1t-1, so (3) gives Bj(t)=Bj−1(t−1)B_j(t)=B_{j-1}(t-1), and induction proves (4).

Now prove the claim for i≥2i\geq2, at time T=2i−2T=2i-2. All smaller entries have settled, and (1) confines ii to the final 2i2i positions. For 1≤j≤i−21\leq j\leq i-2, equations (4) and (1) imply

Bj(T)=fT−j>i,B_j(T)=f_{T-j}>i,

since T−j≥iT-j\geq i. Consequently, putting d=N−2i+1d=N-2i+1, the only possible positions of ii are dd, d+1d+1, and d+3d+3. In the first case it is already permanently placed. In the second case it is the last, and smallest, entry of WW in (3), with r=i−1r=i-1, so the next pass places it in position dd. In the third case it is bi−1b_{i-1}; the next pass puts it last in WW, and the following pass puts it in position dd. This third case takes exactly two further passes. By (4), it occurs exactly when

Bi−1(2i−2)=fi−1=i.B_{i-1}(2i-2)=f_{i-1}=i.

This proves (2) and the induction. Therefore, for N=2k+1N=2k+1 or 2k+22k+2, with k≥1k\geq1,

π∈MN⟺Sk−1(π)1=k.(5)\pi\in\mathfrak M_N \quad\Longleftrightarrow\quad S^{k-1}(\pi)_1=k. \tag{5}

Indeed, all smaller entries have settled by time 2k−22k-2, and (2) decides whether the last required entry takes the full 2k2k passes.

2. The event in (5) uses only an initial prefix

We first record an early-output observation. Suppose that the first LL entries of an input vv are all at least q−1q-1, where q≥2q\geq2. If

S(v)j=q,j≤L−4,S(v)_j=q,\qquad j\leq L-4,

then

vj+2=q−1,S(v)[1:j]=S(v[1:j+2])[1:j].(6)\begin{aligned} v_{j+2}&=q-1,\\ S(v)_{[1:j]}&=S(v_{[1:j+2]})_{[1:j]}. \end{aligned} \tag{6}

To see this, consider the first input entry smaller than q−1q-1, if one exists; its index is at least L+1L+1. Before this entry arrives, the only possible entry below qq smaller than qq is q−1q-1, and at most one larger entry can lie below qq. Hence, if qq is first popped when that smaller entry arrives, its output position is at least L−2L-2. If it arrives later, the first smaller entry has already flushed all but one of the first LL entries, again making an early output impossible. The same bound holds if qq survives to the final flush: at most two entries lie below it. These arguments also cover the case that no entry smaller than q−1q-1 exists. If qq is the first input entry, it is output last.

Thus an output in position j≤L−4j\leq L-4 must be caused by the arrival of q−1q-1, with qq already in the stack. Before q−1q-1 arrives, all preceding entries except qq exceed qq. Entry qq then lies immediately above the first input entry and is popped after all other preceding entries. If q−1q-1 arrives in position hh, this makes the output position of qq equal to h−2h-2. Hence h=j+2h=j+2. At that moment the first jj outputs have already been produced, proving (6). In particular, this input prefix has minimum q−1q-1 at its end, and its first entry is the other entry not yet output.

Apply (6) backwards to (5). At the stage involving Sq−2(π)S^{q-2}(\pi), use

L=N−2q+4,j=2(k−q)+1,q=k,k−1,…,2.\begin{aligned} L&=N-2q+4,\\ j&=2(k-q)+1,\\ q&=k,k-1,\ldots,2. \end{aligned}

Equation (1) supplies the hypothesis on the first LL entries, and j≤L−4j\leq L-4 follows from N≥2k+1N\geq2k+1. We obtain prefixes

Ur=(Sr(π))[1:2(k−r)−1],0≤r≤k−1.\begin{gathered} U_r=(S^r(\pi))_{[1:2(k-r)-1]},\\ 0\leq r\leq k-1. \end{gathered}

with Uk−1=(k)U_{k-1}=(k), such that for 0≤r<k−10\leq r<k-1:

  • UrU_r ends with its minimum r+1r+1;
  • S(Ur)S(U_r) consists of Ur+1U_{r+1}, followed by r+1r+1 and the first entry of UrU_r.

Inducting backwards shows that UrU_r contains every entry r+1,…,kr+1,\ldots,k. Its first entry, which is removed in passing to Ur+1U_{r+1}, must therefore exceed kk. In particular, U0U_0 contains all of 1,…,k1,\ldots,k, and all entries outside this initial 2k−12k-1-letter prefix exceed kk.

Crucially, these prefix relations also work forwards for any extension of U0U_0. When its final minimum 11 is read, every entry of U0U_0 except that minimum and the first entry has already been output. Thus the output starts with U1U_1, regardless of the remaining input. Repeating this argument for the final minimum of each UrU_r shows that the (k−1)(k-1)-st output begins with kk. The argument is unchanged under any increasing relabelling that fixes 1,…,k1,\ldots,k. For k=1k=1, the same conclusion is immediate: the event is simply that the first entry is 11.

3. The bijection

Let n≥2n\geq2 and put k=n−1k=n-1. If π∈M2n\pi\in\mathfrak M_{2n}, its initial 2k−12k-1-letter prefix contains all entries 1,…,k1,\ldots,k, so its last entry tt belongs to {n,…,2n}\{n,\ldots,2n\}. Delete this last entry and standardize the remaining permutation, obtaining σ∈S2n−1\sigma\in S_{2n-1}. Standardization fixes 1,…,k1,\ldots,k and preserves the order of the initial prefix. Section 2 and (5) therefore give σ∈M2n−1\sigma\in\mathfrak M_{2n-1}.

Conversely, given σ∈M2n−1\sigma\in\mathfrak M_{2n-1} and t∈{n,…,2n}t\in\{n,\ldots,2n\}, increase each entry of σ\sigma that is at least tt by one, and append tt. The same prefix argument shows that the resulting permutation lies in M2n\mathfrak M_{2n}. These two constructions are inverse. There are exactly n+1n+1 choices for tt, proving the recurrence for n≥2n\geq2.

For n=1n=1, all permutations of lengths one and two are already periodic. Hence ∣M1∣=1|\mathfrak M_1|=1 and ∣M2∣=2|\mathfrak M_2|=2, proving the remaining case.