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 )
![]() | 7 | No.7 Revision |
UPDATED 2025-01-23
What you ask for corresponds to (periodic) Lyndon words composed of the differences between consecutive elements (summing to n
). Check this out:
n=4
m=3
G=Zmod(n)
import itertools
CMB = [ tuple(itertools.accumulate(map(G,w))) tuple(itertools.accumulate(map(G,list(w)*d))) for d in divisors(m) for w in LyndonWords(n,m) LyndonWords(n,m//d) if sum(w)==n sum(w)*d==n ]
print( CMB )
Another possible solution:
def is_canonical(c):
try:
LyndonWord(c[i]-c[i-1] w = Word(c[i]-c[i-1] for i in range(len(c)))
except ValueError:
p = w.periods(True)
if p: w = w[:p[0]]
try: LyndonWord(w)
except ValueError: return False
return True
CMB = list( filter(is_canonical, Combinations(G,m)) )
print( CMB )
![]() | 8 | No.8 Revision |
UPDATED 2025-01-23
What you ask for corresponds to (periodic) Lyndon words composed of the differences between consecutive elements (summing to n
). Check this out:
n=4
m=3
G=Zmod(n)
import itertools
CMB = [ tuple(itertools.accumulate(map(G,list(w)*d))) for d in divisors(m) for w in LyndonWords(n,m//d) if sum(w)*d==n ]
print( CMB )
Another possible solution:
def is_canonical(c):
w = Word(c[i]-c[i-1] for i in range(len(c)))
p = w.periods(True)
if p: w = w[:p[0]]
try: LyndonWord(w)
except ValueError: return False
return True
w.is_lyndon()
CMB = list( filter(is_canonical, Combinations(G,m)) )
print( CMB )
![]() | 9 | No.9 Revision |
UPDATED 2025-01-232025-01-24
What you ask for corresponds to (periodic) Lyndon words composed of the differences between consecutive elements (summing to n
). Check this out:
n=4
m=3
G=Zmod(n)
import itertools
CMB = [ tuple(itertools.accumulate(map(G,list(w)*d))) for d in divisors(m) divisors(gcd(m,n)) for w in LyndonWords(n,m//d) if sum(w)*d==n ]
print( CMB )
Another possible solution:
def is_canonical(c):
if c[0]: return False
w = Word(c[i]-c[i-1] for i in range(len(c)))
p = w.periods(True)
if p: w = w[:p[0]]
return w.is_lyndon()
CMB = list( filter(is_canonical, Combinations(G,m)) )
print( CMB )