13 lines
269 B
Text
13 lines
269 B
Text
factors = function(n)
|
|
result = [1]
|
|
for i in range(2, n)
|
|
if n % i == 0 then result.push i
|
|
end for
|
|
return result
|
|
end function
|
|
|
|
while true
|
|
n = val(input("Number to factor (0 to quit)? "))
|
|
if n <= 0 then break
|
|
print factors(n)
|
|
end while
|