You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
240 B
14 lines
240 B
4 years ago
|
def primes(kmax):
|
||
|
p = []
|
||
|
k = 0
|
||
|
n = 2
|
||
|
while k < kmax:
|
||
|
i = 0
|
||
|
while i < k and n % p[i] <> 0:
|
||
|
i = i + 1
|
||
|
if i == k:
|
||
|
p.append(n)
|
||
|
k = k + 1
|
||
|
n = n + 1
|
||
|
return p
|