projects
/
cython.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
merged changes from 0.9.6.10
[cython.git]
/
Demos
/
primes.pyx
1
print "starting"
2
3
def primes(int kmax):
4
cdef int n, k, i
5
cdef int p[1000]
6
result = []
7
if kmax > 1000:
8
kmax = 1000
9
k = 0
10
n = 2
11
while k < kmax:
12
i = 0
13
while i < k and n % p[i] <> 0:
14
i = i + 1
15
if i == k:
16
p[k] = n
17
k = k + 1
18
result.append(n)
19
n = n + 1
20
return result