#Homework 18 by Ben Miles for Experimental math OK to post #Number 2 with(combinat): WnS:=proc(A,FP,B,n) local s,S,T: S:=SetWnS(A,FP,B,n): T:={}: for s in S do T:=T union {nops(S)}: od: max(T): end: AllWords:=proc(A,n) local i,S,S1,a,s: if n=0 then RETURN({}): elif n=1 then RETURN({seq([A[i]],i=1..nops(A))}): fi: S:=AllWords(A,n-1): S1:={}: for a in A do for s in S do S1:={op(S1),[a,op(s)]}: od: od: S1: end: IsBad1:=proc(w,fp1,B) local w1, fp2: if nops(w)