Last active
August 20, 2019 19:03
-
-
Save AICDEV/7d31d4e121cf2aa81d18298ec573aa7c to your computer and use it in GitHub Desktop.
Python finding prime numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
know_prime_number = [2,3,5,7,11] | |
for i in range(12,1000): | |
notIs = False | |
for n in know_prime_number: | |
if(n <= math.sqrt(i)): | |
if((i % n) == 0): | |
notIs = False | |
break | |
else: | |
notIs = True | |
if(notIs): | |
know_prime_number.append(i) | |
print("found the following prime numbers") | |
print(know_prime_number) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment