if args.regen or not n: n = 2 while True: p_gen = partition_gen(n) for p in p_gen: p = Partition(*p) p2 = p.conjugate() if p.is_2special() and p2.is_2special(): p_str = ",".join(map(str, p.vals)) p2_str = ",".join(map(str, p2.vals)) # see if candidate or conjugate is already in db; otherwise compute & insert solution. in_db = cur.execute("SELECT * FROM specht WHERE partition=?", (p_str, )).fetchone() if in_db != None and not args.regen: # with --regen, override existing db contents continue if p.num_row_perms() > p2.num_row_perms(): faster_p = p else: faster_p = p2 if args.verbosity > 0: print "Next partition: {}".format(faster_p) if args.c: print 1 solution = find_solution_concurrent( faster_p, verbosity=args.verbosity) print 1 else: solution = find_solution_new(faster_p, verbosity=args.verbosity) # conjugate has same solution, so insert both cur.execute(