#April 23, 2026 C25.txt Help25:=proc(): print(`pTOScMat(n), Eni(n,i), Mul(pi,sig) Sn(n), inv(pi) `): print(`AllFacts(pi)`): end: read `C23.txt`: read `C24.txt`: read `C18.txt`: with(combinat): pTOScMat:=proc(n): #evalm(pTOmMat(n)&*inverse(ScTOmMat(n))): evalm(pTOmMat(n)&*ScTOmMat(n)&^(-1)): end: #Thanks to Aurora H. ScTOmMat:=proc(n) local SB,x,i: SB:=ScBase(n,x): matrix([seq(mVec(SB[i],x,n),i=1..nops(SB))]): end: #Eni(n,i): The adjacent trans. i->i+1 i+1->i Eni:=proc(n,i) local j:[seq(j,j=1..i-1),i+1,i,seq(j,j=i+2..n)]:end: #Mul(pi,sig): The permutation pi times the permutation sig Mul:=proc(pi,sig) local i:[seq(sig[pi[i]],i=1..nops(pi))]:end: #Sn(n): The list of length(?) such that L[i] is the set of #permutations of length i-1 Sn:=proc(n) local L,A,N,j,pi: A:={[seq(j,j=1..n)]}: L:=[A]: N:={seq(seq(Mul(Eni(n,j),pi), pi in L[-1]),j=1..n-1)} minus A: while N<>{} do L:=[op(L),N]: A:=A union N: N:={seq(seq(Mul(Eni(n,j),pi), pi in L[-1]),j=1..n-1)} minus A: od: L: end: #inv(pi): the number of inversions of the permutation pi inv:=proc(pi) local i,j,n,co: n:=nops(pi): co:=0: for i from 1 to n-1 do for j from i+1 to n do if pi[i]>pi[j] then co:=co+1: fi: od: od: co: end: #AllFacts(pi): inputs a permutation pi and outputs the set #of all ways of writing as a product of generators #[3,1,2,4] Eni(n,3)*... AllFacts:=proc(pi) local n,S,j,pi1,S1,s1,i: option remember: n:=nops(pi): if pi=[seq(j,j=1..n)] then RETURN({[]}): fi: S:={}: for i from 1 to n-1 do pi1:=Mul(pi,Eni(n,i)): if inv(pi1)