#OK to post #Yuxuan Yang, March 12th, Assignment 14 with(combinat): #1 BZ:=proc(L,j) local i,t: t:=nops(L): if t+j*3>=L[1] then RETURN([t+3*j-1,op(L-[1$t])]): else RETURN([op(2..t,L+[1$t]),1$(L[1]-3*j-t-1)]) fi: end: Glashier:=proc(L) local i,j,L1,n,S,L2: n:=add(L): L1:=[0$(L[1])]: for i from 1 to nops(L) do L1[L[i]]:=L1[L[i]]+1: od: S:={}: for i from 1 to L[1] do L2:=convert(L1[i], base ,2): for j from 1 to nops(L2) do if L2[j]=1 then S:=S union {2^(j-1)*i}: fi: od: od: sort(convert(S,list),`>`): end: InvGlashier:=proc(L) local i,L1: for i from 1 to nops(L) do if L[i] mod 2 =0 then L1:=[op(1..i-1,L),op(i+1..nops(L),L),L[i]/2,L[i]/2]: RETURN(InvGlashier(L1)): fi: od: RETURN(sort(L,`>`)): end: #ODD->DIS Sylverster:=proc(L) local nopsL,i,m,n: nopsL:=nops(L): n:=add(L): if n=nopsL then RETURN([n]): fi: m:=0: for i from 1 to nopsL do if L[i]=1 then m:=m+1: fi: od: [(L[1]-1)/2+nopsL,(L[1]-1)/2+nopsL-m-1,op(Sylverster([op(2..(nopsL-m),L)]-[2$(nopsL-m-1)]))]: end: #DIS->ODD InvSylverster:=proc(L) local i,s,n,m,L1,r: s:=nops(L): n:=add(L): if s=1 then RETURN([1$n]): fi: m:=L[1]-L[2]-1: if s=2 then RETURN([2*L[2]+1,1$m]): fi: L1:=InvSylverster([op(3..s,L)]): r:=nops(L1)+1: [2*(L[2]-r+1)+1,op(L1+[2$(r-1)]),1$m]: end: #Conj(L):Conjugate partition Conj:=proc(L) local L1,k,i: if L=[] then RETURN([]): fi: k:=nops(L): L1:=L-[1$k]: for i from 1 to nops(L1) while L1[i]<>0 do od: L1:=[op(1..i-1,L1)]: [k, op(Conj(L1))]: end: