You may recognize this code as the Sieve of Eratosthenes, which finds all primes below a given maximum. You can download all the files referenced in this tutorial at the link below:ġ MAX_PRIME = 100 2 3 sieve = * MAX_PRIME 4 for i in range ( 2, MAX_PRIME ): 5 if sieve : 6 print ( i ) 7 for j in range ( i * i, MAX_PRIME, i ): 8 sieve = False
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |