Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News Sign UpSign In
| Download
Views: 59
sage_server.MAX_OUTPUT_MESSAGES = 10000000 sage_server.MAX_OUTPUT = 10000000 from sage.combinat.matrices.latin import * from sage.combinat.permutation import * n = 5 Ln = [1,2,12,576,161280] lsg = LatinSquare_generator(back_circulant(n)) lsg2 = LatinSquare_generator(back_circulant(n)) LS = [] M = MatrixSpace(ZZ, n) L = M(next(lsg).list()) LS.append(L) while len(LS) < Ln[n-1]: if len(LS) % 10000 == 0: print len(LS) sys.stdout.flush() A = M(next(lsg2).list()) try: i = LS.index(A) except ValueError: LS.append(A) len(LS) sys.stdout.flush() els = 0 ols = 0 B = matrix(ZZ, n, lambda i, j: 1) for i in range(len(LS)): A = LS[i] L = LatinSquare(A) if L.is_latin_square(): L = LatinSquare(A+B) rowpar = 1 colpar = 1 for j in range(n): if Permutation(L.row(j)).is_even(): rowpar *= 1 else: rowpar *= -1 if Permutation(L.column(j)).is_even(): colpar *= 1 else: colpar *= -1 if rowpar * colpar == 1: els += 1 else: ols += 1 print "n" n print "L(n)" len(LS) print "els(n)" els print "ols(n)" ols
10000 20000 30000 30000 40000 50000 50000 60000 70000 70000 80000 80000 80000 80000 90000 90000 100000 110000 110000 120000 120000 120000 120000 120000 120000 130000 130000 130000 130000 130000 130000 130000 130000 130000 130000 130000 130000 130000 130000 130000 130000 130000 130000 130000 130000 130000 130000 140000 140000 140000 140000 140000 140000 140000 140000 140000 140000 140000 140000 140000 140000 140000 140000 140000 140000 140000 140000 140000 140000 140000 140000 140000 140000 140000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 150000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 160000 161280 n 5 L(n) 161280 els(n) 80640 ols(n) 80640