| Current Path : /proc/242857/task/243052/root/opt/alt/python37/share/doc/alt-python37-Cython/Demos/ |
| Current File : //proc/242857/task/243052/root/opt/alt/python37/share/doc/alt-python37-Cython/Demos/primes.pyx |
# cython: language_level=3
print("starting")
def primes(int kmax):
# cdef int n, k, i
cdef int p[1000]
result = []
if kmax > 1000:
kmax = 1000
k = 0
n = 2
while k < kmax:
i = 0
while i < k and n % p[i] != 0:
i += 1
if i == k:
p[k] = n
k += 1
result.append(n)
n += 1
return result