Skip to content

Instantly share code, notes, and snippets.

@odevine
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save odevine/55f0ec43885eb652931c to your computer and use it in GitHub Desktop.

Select an option

Save odevine/55f0ec43885eb652931c to your computer and use it in GitHub Desktop.
Just a simple method to generate primes and list which prime has been generated.
import math
def main():
count = 2
count2 = 1
while True:
isprime = True
for x in range(2, int(math.sqrt(count) + 1)):
if count % x == 0:
isprime = False
break
if isprime:
print " prime = %s %s primes generated" % (count, count2)
count2 += 1
count += 1
main()
@noahbass
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment