Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
Sieve of Eratosthenes in Python
SUBMITTED BY:
Guest
DATE:
June 5, 2015, 8:44 a.m.
FORMAT:
Python
SIZE:
186 Bytes
Raw
Download
Tweet
HITS:
2099
Go to comments
Report
def
eratosthenes2
(
n
):
multiples
=
set
()
for
i
in
range
(
2
,
n
+
1
):
if
i
not
in
multiples
:
yield
i
multiples
.
update
(
range
(
i
*
i
,
n
+
1
,
i
))
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus