George Pólya and Robert Redfield independently developed a theory of generating functions that describe the action of a group G on colorings of a set S by a set T when we know the action of G on S. Pó...George Pólya and Robert Redfield independently developed a theory of generating functions that describe the action of a group G on colorings of a set S by a set T when we know the action of G on S. Pólya’s work on the subject is very accessible in its exposition, and so the subject has become popularly known as Pólya theory, though Pólya-Redfield theory would be a better name. In this section we develop the elements of this theory.
def nextpar(mults, n): if mults == []: return Partitions(n).first().to_exp(n) p = Partition(exp=mults).next() if p != False: return(p.to_exp(n)) else: return p def polya(n): var("x"); global y; y = li...def nextpar(mults, n): if mults == []: return Partitions(n).first().to_exp(n) p = Partition(exp=mults).next() if p != False: return(p.to_exp(n)) else: return p def polya(n): var("x"); global y; y = list(var('x_%d' % i) for i in range(binomial(n,2)+1)); max_sub = n; j = Partition([0]); j = nextpar(j,n); p=0; lim1 = floor(n / 2); lim2 = floor((n-1) / 2); while j != False: t = 1; for k in range(1,lim1+1): if j[2*k-1] > 0: t = t * y[k]^j[2*k-1]; if (j[2*k-1] > 0) and (k > 1): t = t * y[2*k]^((k-1)*…