Module:Rational: Difference between revisions

Plumtree (talk | contribs)
m Bugfix
Plumtree (talk | contribs)
m Refactoring
Line 468: Line 468:
end
end
-- preparing the argument
-- preparing the argument
local largest_prime = -1
local max_prime = p.max_prime(a)
for factor, power in pairs(a) do
if type(factor) == 'number' then
if factor > largest_prime then
largest_prime = factor
end
end
end
local template_arg = ''
local template_arg = ''
for i = 2, largest_prime do
for i = 2, max_prime do
if u.is_prime(i) then
if u.is_prime(i) then
if i > 2 then template_arg = template_arg .. ' ' end
if i > 2 then template_arg = template_arg .. ' ' end