Commit 7ab8b329 authored by Stefan Behnel's avatar Stefan Behnel

fix up example code

--HG--
extra : transplant_source : %CA%C1%8A%A1%D8g%1C%B1%00R%CA%C2%09%11%08%CE%60IG%1A
parent 49cbeb03
def primes(kmax): def primes(kmax):
result = [] result = []
if kmax > 1000: if kmax > 1000:
kmax = 1000 kmax = 1000
p = [0] * 1000
k = 0
n = 2
while k < kmax: while k < kmax:
i = 0 i = 0
while i < k and n % p[i] != 0: while i < k and n % p[i] != 0:
i = i + 1 i += 1
if i == k: if i == k:
p[k] = n p[k] = n
k = k + 1 k += 1
result.append(n) result.append(n)
n = n + 1 n += 1
return result return result
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment