RosettaCodeData/Task/Loops-Increment-loop-index-within-loop-body/Nanoquery/loops-increment-loop-index-within-loop-body.nanoquery
2023-07-01 13:44:08 -04:00

28 lines
461 B
Text

limit = 42
def isPrime(n)
if ((n % 2) = 0) or ((n % 3) = 0)
return false
end
d = 5
while (d * d) <= n
if (n % d) = 0
return false
end
d += 2
if (n % d) = 0
return false
end
d += 4
end
return true
end
i = limit
for (n = 0) (n < limit) (i += 1)
if isPrime(i)
n += 1
print format("n = %-2d %,19d\n", n, i)
i += i - 1
end
end