RosettaCodeData/Task/Count-in-factors/Ring/count-in-factors.ring
2016-12-05 23:44:36 +01:00

15 lines
299 B
Text

for i = 1 to 20
see "" + i + " = " + factors(i) + nl
next
func factors n
f = ""
if n = 1 return "1" ok
p = 2
while p <= n
if (n % p) = 0
f += string(p) + " x "
n = n/p
else p += 1 ok
end
return left(f, len(f) - 3)