Module:Interval table: Difference between revisions
CompactStar (talk | contribs) No edit summary |
gcd no longer needs to be defined here |
||
| Line 27: | Line 27: | ||
end | end | ||
return result | return result | ||
end | end | ||
| Line 37: | Line 33: | ||
local ratios = {} | local ratios = {} | ||
local ratio_strings = {} | local ratio_strings = {} | ||
for i=1,max_nd do | for i = 1, max_nd do | ||
for j=1,max_nd do | for j = 1, max_nd do | ||
t = i/ | t = i/u._gcd(i, j) .. "/" .. j/u._gcd(i, j) | ||
if (i/j) >= 1 and (i/j) <= max_size and get_limit(i, j) <= prime_limit and not u.table_contains(ratio_strings, t) then | if (i/j) >= 1 and (i/j) <= max_size and get_limit(i, j) <= prime_limit and not u.table_contains(ratio_strings, t) then | ||
ratios[#ratios + 1] = {i/ | ratios[#ratios + 1] = {i/u._gcd(i, j),j/u._gcd(i, j)} | ||
ratio_strings[#ratio_strings + 1] = t | ratio_strings[#ratio_strings + 1] = t | ||
end | end | ||