Godtone (talk | contribs)
Godtone (talk | contribs)
My Python 3 code: there is only finitely many EDOs which provide some simplification of a set of intervals as contrasted to all-distinct
Line 1,550: Line 1,550:
print()
print()
return spaces
return spaces
# there is only finitely many EDOs which provide some simplification of a set of intervals as contrasted to all-distinct
def efficient_edos( n, inconsistencies=0, min_simplifications=1, edos=range(1,1000) ):
if type(n)==int:
n = odd_lim(n)
elif type(n)==list and type(n[0])==int:
n = odd_lim(1,[],n)
results = []
for edo in edos:
v = edo
if type(v)==int:
v = val( lim(max([ prime_idx(len(fact(x))-1) for x in n ])), ed(edo) )
# else v is assumed to be a mapping
m = dict()
for x in n: # collect mappings of intervals
sedo = map_iv(v,x)
if sedo in m:
m[sedo].append(x)
else:
m[sedo] = [x]
if len(inconsistent_ivs_by_val(n,v)) <= inconsistencies:
if len(n) - len([ sedo for sedo in m ]) >= min_simplifications:
results.append(edo)
return results
</syntaxhighlight>
</syntaxhighlight>