Quantcast
Viewing latest article 11
Browse Latest Browse All 28

Answer by Pythoscorpion for Sieve of Eratosthenes - Finding Primes Python

i think this is shortest code for finding primes with eratosthenes method

def prime(r):    n = range(2,r)    while len(n)>0:        yield n[0]        n = [x for x in n if x not in range(n[0],r,n[0])]print(list(prime(r)))

Viewing latest article 11
Browse Latest Browse All 28

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>