Skip to content

Instantly share code, notes, and snippets.

@AICDEV
Last active August 20, 2019 19:03
Show Gist options
  • Save AICDEV/7d31d4e121cf2aa81d18298ec573aa7c to your computer and use it in GitHub Desktop.
Save AICDEV/7d31d4e121cf2aa81d18298ec573aa7c to your computer and use it in GitHub Desktop.
Python finding prime numbers
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