Skip to content

Instantly share code, notes, and snippets.

@rberaldo
Created November 16, 2012 02:52
Show Gist options
  • Save rberaldo/4083533 to your computer and use it in GitHub Desktop.
Save rberaldo/4083533 to your computer and use it in GitHub Desktop.
Getting prime numbers from 1000 to 0
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