#Please do not post homework #Guy Adami, 2026-03-29, Assignment 17 #_____________________________________ Conj:=proc(L) local k,C1,i1,L1,i: option remember: if L=[] then RETURN([]): fi: k:=nops(L): L1:=[seq(L[i]-1,i=1..k)]: for i1 from 1 to nops(L1) while L1[i1]>0 do od: i1:=i1-1: L1:=[op(1..i1,L1)]: C1:=Conj(L1): [k,op(C1)]: end: #_____________________________________ HLc:=proc(L,c) local i,j,L1: L1:=Conj(L): i:=c[1]: j:=c[2]: L[i]-j+L1[j]-i+1: end: #_____________________________________ #Cells(L): the set of n (=sum(L)) cells [i,j]in the shape L Cells:=proc(L) local k,i,j: k:=nops(L): {seq(seq([i,j] , j=1..L[i] ), i=1..k)} end: #_____________________________________ Hook:=proc(L,c) local k,i,j,C,i1,j1,i2: k:=nops(L): i:=c[1]: j:=c[2]: if not (i>=1 and i<=k) then RETURN(FAIL): fi: if not(j>=1 and j<=L[i]) then RETURN(FAIL): fi: C:={seq([i,j1],j1=j..L[i])}: for i2 from i to k while j<=L[i2] do od: i2:=i2-1: C:=C union {seq([i1,j],i1=i..i2)}: end: #-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ #Question 1 RandSYT:= proc(L) local n, Y, L1, corners,Tcell,c, C, row, col, i,j: n:= add(i, i in L): L1:= L: Y:= []: #Makes a Young tableux of all zeros to be filled in later for i from 1 to nops(L) do Y := [op(Y), [seq(0, j = 1 .. L[i])]]: od: for i from n by -1 to 1 do corners:= []: #Get all current corners C:= Cells(L1): for c in C do if HLc(L1,c) = 1 then corners:= [op(corners),c]: fi: od: #Pick a random corner Tcell := corners[rand(1..nops(corners))()]; row:= Tcell[1]: col:= Tcell[2]: #Fill in that element into Y Y[row][col]:=i: #Update the shape L1[row]:=L1[row]-1: #remove row if = 0 if L1[row] = 0 then L1:= subsop(row=NULL, L1): fi: od: RETURN(Y); end: #-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ Probability2:=proc(m,L) local L, i, r, c,R: r:=0: c:=0: for i from 1 to m do R:=RandSYT(L); if R[1][2] = 2 then r:=r+1: elif R[2][1] = 2 then c:=c+1: fi: od: r/m; end: #Running for 10000 random SYTs, the probability found was 5037/10000 or 50.37%