Q:

Write a Python program using Sieve of Eratosthenes method for computing primes upto a specified number.

0

Write a Python program using Sieve of Eratosthenes method for computing primes upto a specified number. 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

def prime_eratosthenes(n):
    prime_list = []
    for i in range(2, n+1):
        if i not in prime_list:
            print (i)
            for j in range(i*i, n+1, i):
                prime_list.append(j)

print(prime_eratosthenes(100));

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now