1 | initial version |
What you ask for corresponds to Lyndon words composed of distinct elements. Check this out:
n=4
m=3
G=Zmod(n)
CMB = [ tuple(map(G,w)) for w in LyndonWords(n,m) if len(set(w))==m ]
print( CMB )
2 | No.2 Revision |
What you ask for corresponds to Lyndon words composed of distinct elements. Check this out:
n=4
m=3
G=Zmod(n)
CMB = [ tuple(map(G,w)) for w in LyndonWords(n,m) if len(set(w))==m and w[0]==0 ]
print( CMB )
3 | No.3 Revision |
What you ask for corresponds to Lyndon words composed of distinct elements. Check this out:
n=4
m=3
G=Zmod(n)
CMB = [ tuple(map(G,w)) sorted(map(G,w)) for w in LyndonWords(n,m) if len(set(w))==m and w[0]==0 w[-1]==n ]
print( CMB )
4 | No.4 Revision |
What you ask for corresponds to Lyndon words composed of distinct elements. Check this out:
n=4
m=3
G=Zmod(n)
CMB = [ sorted(map(G,w)) for w in LyndonWords(n,m) if len(set(w))==m and w[-1]==n w[0]==1 ]
print( CMB )
5 | No.5 Revision |
What you ask for corresponds to Lyndon words composed of distinct elements. the differences between consecutive elements (summing to n
). Check this out:
import itertools
n=4
m=3
G=Zmod(n)
CMB = [ sorted(map(G,w)) tuple(itertools.accumulate(map(G,w))) for w in LyndonWords(n,m) if len(set(w))==m and w[0]==1 sum(w)==n ]
print( CMB )
6 | No.6 Revision |
What you ask for corresponds to Lyndon words composed of the differences between consecutive elements (summing to n
). Check this out:
import itertools
n=4
m=3
G=Zmod(n)
import itertools
CMB = [ tuple(itertools.accumulate(map(G,w))) for w in LyndonWords(n,m) if sum(w)==n ]
print( CMB )
Another possible solution:
def is_canonical(c):
try:
LyndonWord(c[i]-c[i-1] for i in range(len(c)))
except ValueError:
return False
return True
CMB = list( filter(is_canonical, Combinations(G,m)) )
print( CMB )