# permtest.py # some noodlings with permutations.py import permutations as perm import random import operator as op r1 = range(26) id = perm.Permutation(r1) #print id cy=r1[1:]+r1[:1] cy = perm.Permutation(cy) #print cy t = range(26) random.shuffle(t) t = perm.Permutation((tuple(t),)) t = t**13 #print t def six(): r2 = range(26) random.shuffle(r2) ra = perm.Permutation(r2) c = id p = 6*[None] p[0] = t^ra for k in range(1,6): c=c*cy p[k]=t^(ra^c) prods = [p[3]*p[0],p[4]*p[1],p[5]*p[2]] fp = [] for k in range(3): fp.append(prods[k].fixedpoints()) nfps = map(len,fp) if max(nfps)>4: for pts in fp: print pts return ra,p,prods ra,p,prods=six() print "-----------------------------------" print "random inner block=" print t print print "random rotor" print ra print print "p4*p1,p5*p2,p6*p3=" for pk in prods: print pk print print "The cycle structure of these products is" for pk in prods: print pk.cyclestructure(),"\twith fixed points",pk.fixedpoints()