Last active
August 29, 2015 14:13
-
-
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.
This file contains hidden or 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 | |
| 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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
😊 https://gist.github.com/noahbass/dcd20e903f1753836ba3