import itertools, sys from hm import set_partitions def canon(blocks): # blocks: list of sets over positions 0..m-1 ; return canonical tuple of sorted tuples return tuple(sorted(tuple(sorted(b)) for b in blocks if b)) def noncrossing(P): for A,B in itertools.permutations(P,2): for a1,a2 in itertools.combinations(A,2): for b1,b2 in itertools.combinations(B,2): if a1 k-1 legs; new leg placed at position of min, cyclic handled by relabel # relabel so that merged leg sits at position i (if j==i+1) ; for cyclic pair (k-1,0) put merged leg at position 0 bi=[b for b in P if i in b][0]; bj=[b for b in P if j in b][0] blocks=[set(b) for b in P if b not in (bi,bj)]+[set(bi)|set(bj)] # remove j, map i/j -> merged position if j==i+1: f=lambda x: x if x1 else 6 for k_ in [4,5]: print('sanity level',k_,'dim K for N=7,10,100:',[dimK(k_,N)[0] for N in (7,10,100)],flush=True) res={} for N in list(range(6,41))+[97,1009,10**6+3]: res[N]=dimK(k,N)[0] print('level',k,': dim K(N) =',res,flush=True)