Created
November 16, 2012 02:52
-
-
Save rberaldo/4083533 to your computer and use it in GitHub Desktop.
Getting prime numbers from 1000 to 0
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
def is_prime(n): | |
count = 2 | |
if n < count: | |
return False | |
else: | |
while count < n: | |
if n % count == 0: | |
return False | |
else: | |
count += 1 | |
else: | |
return True | |
number = 1000 | |
while number > 0: | |
if is_prime(number): | |
print(number) | |
number -= 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment