mirror of
https://github.com/zekexiao/pocketlang.git
synced 2025-02-06 12:46:53 +08:00
20 lines
302 B
Plaintext
20 lines
302 B
Plaintext
|
from lang import clock
|
||
|
|
||
|
def is_prime(n)
|
||
|
if n < 2 then return false end
|
||
|
for i in 2..n
|
||
|
if n % i == 0 then return false end
|
||
|
end
|
||
|
return true
|
||
|
end
|
||
|
|
||
|
start = clock()
|
||
|
|
||
|
N = 60000; primes = []
|
||
|
for i in 0..N
|
||
|
if is_prime(i)
|
||
|
list_append(primes, i)
|
||
|
end
|
||
|
end
|
||
|
print("elapsed:", clock() - start, "s")
|