Help:=proc(): print(` Colorings(m,g), IsPC(CO,W)`): print(`NuA(m,g,W) `): end: #The set of all Colorings of {1,...m} with g colors #A coloring is expressed as a list L of length m #where L[i]=c means that vertex i is colored with color c Colorings:=proc(m,g) local S,S1,s1,c: option remember: if m=0 then RETURN({[]}): fi: S1:=Colorings(m-1,g): {seq(seq([op(s1),c] , c=1..g),s1 in S1)}: end: #IsPC(CO,W): Inputs a coloring CO of {1, ...,m} #(a list of length m) and a subset,W, of {1, ...,m} #decides whether the set A is PC by CO, in other words #all the colors assigned to the members of the set A #are different IsPC:=proc(CO,W) local a: evalb(nops({seq(CO[a],a in W)})=nops(W)) : end: #NuA(m,g,W):inputs a pos. integer g, and a pos. integers #and a subset of {1, ..., m} W, finds the number of #g-colorings of {1, ...,m} that properly colors the #set A NuA:=proc(m,g,W) local CO,Suc,COs: COs:=Colorings(m,g): Suc:=0: for CO in COs do if IsPC(CO,W) then Suc:=Suc+1: fi: od: Suc: end: #Justin(g,m,a): the number of Proper colorings with g colors #of a set with a elements Justin:=proc(g,m,a) local i: mul(g-i,i=0..a-1)*g^(m-a): end: #JustinP(g,m,a): the probability #of Proper colorings with g colors #of a set with a elements JustinP:=proc(g,m,a) local i: mul(g-i,i=0..a-1)*g^(-a): end: