#OK to post #Yuxuan Yang, April 2nd, Assignment 18 with(combinat): Aigner:=proc(n) local i,j,k,m,L,CD,new,tem,set1: L:=[seq(choose(n,i),i=0..n)]: CD:=[]: while nops(CD)0 do tem:=0: for set1 in L[m] while tem=0 do if nops(convert(new[-1],`set`) minus convert(set1,`set`))=0 then tem=1: new:=[op(new),set1]: L[m]:=convert(convert(L[m],`set`) minus {set1},`list`): fi: od: od: CD:=[op(CD),new]: od: end: SCD:=proc(n) local i,ind,new,ch,ch1,ch2,se: if n=0 then RETURN([[[]]]): fi: if n=1 then RETURN([[[],[1]]]): fi: ind:=SCD(n-1): new:=[]: for ch in ind do ch1:=[op(ch),[op(ch[-1]),n]]: if nops(ch1)<>0 then new:=[op(new),ch1]: fi: od: for ch in ind do ch2:=[]: for i from 1 to nops(ch)-1 do ch2:=[op(ch2),[op(ch[i]),n]]: od: if nops(ch2)<>0 then new:=[op(new),ch2]: fi: od: new: end: #seq(evalb(convert(SCD(a), set) = convert(Aigner(a), set)), a = 1 .. 10) #verified outputs.