Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Curso primes
import math
def erathostenes(n):
primes = list(range(2, n+1))
i = 2
while(i <= int(math.sqrt(n))):
if i in primes:
for j in list(range(i*2, n+1, i)):
if j in primes:
primes.remove(j)
i += 1
return primes
number = 10
primes = erathostenes(number)
print(primes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.