We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eae4c21 commit dece4c0Copy full SHA for dece4c0
n_primes.py
@@ -0,0 +1,9 @@
1
+# Eratosthenes application of sieve algorithm
2
+def eratosthenes2(n):
3
+ multiples = set()
4
+ for i in range(2, n+1):
5
+ if i not in multiples:
6
+ yield i
7
+ multiples.update(range(i*i, n+1, i))
8
+
9
+primes = list(eratosthenes2(4000000))
0 commit comments