#Homework by Mike Murr #OK to post #hw14 #BZ(L,j): Implements “Bijecting Euler’s Partition Recurrence” by # David Bressoud and Doron Zeilberger, January, 1985. # Inputs a partition L and an integer j. # Outputs a partition Lprime and an integer jprime, # where jprime has opposite parity from j and # Lprime and jprime satisfy an additional property. BZ:=proc(L,j) local a, t, i, n1, lhs, rhs, Lprime, jprime; if nops(L) = 0 then print(`L is empty`); return(Fail); fi; a:=(3*j^2+j)/2; t:=nops(L); n1:=sum(L[i],i=1..t); lhs:=t + 3*j; rhs:=L[1]; print(a); print(n1); if lhs>=rhs then # Lprime[1]:= t + 3*j - 1; # for i from 1 to t do # Lprime[i+1] := L[i] - 1; # od; Lprime := [t + 3*j - 1, seq(L[i]-1,i=1..t)]; jprime := j - 1; fi; if lhs < rhs then Lprime:= [seq(L[i]+1,i=2..t), seq(1,i=1..L[1]-3*j-t-1)]; jprime:= j + 1; fi; return(Lprime,jprime); end proc; BZ([5,5,4,3,2],1); BZ([7,4,4,3,2,1],0); #Glaisher(L): Implements Glaisher’s bijection from a partition with odd parts to a # partition with distinct parts. # One reference for this is “Partition Bijections, A Survey,” by Igor Pak. # math.ucla.edu/~pak/papers/psurvey.pdf # Glaisher’s is on page 20 of the survey. Glaisher:=proc(L) local L0,count, odds, multOdds, i, index, j, mult, r, output; L0:=[op(L),0]; if nops(L) = 0 then return([]); fi; if nops(L) = 1 then return(L); fi; count:=1; index:=1; odds:=[]; multOdds:=[]; output:=[]; for i from 1 to nops(L0)-1 do if L0[i+1]=L0[i] then count:=count+1; # print(i); else odds:=[op(odds), L[i]]; multOdds:=[op(multOdds), count]; count:=1; index:=index+1; fi; od; #print(odds); #print(multOdds); # odds:= each odd part # multOdds:= the multiplicity of each odd part for i from 1 to nops(odds) do mult:=multOdds[i]; r:=0; while mult > 0 do if mult mod 2 = 1 then output:=[op(output), odds[i]*2^r]; fi; mult:= iquo(mult,2); r:=r+1; od; od; output:=sort(output,`>`); print(output); end proc; Glaisher([5,5,5,3,3]); Glaisher([7,7,7,7,1,1,1,1]);