Skip to content

Instantly share code, notes, and snippets.

@timhberry
Created November 7, 2016 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timhberry/0bac5d8a6a80f1f6701af1bf7b62a910 to your computer and use it in GitHub Desktop.
Save timhberry/0bac5d8a6a80f1f6701af1bf7b62a910 to your computer and use it in GitHub Desktop.
# print all the prime numbers up to 'upto'
# quick project for UTAustinX UT.9.10x
# Effective Thinking Through Mathematics
# and Open Source Society University
num = 2
upto = 1000
while num < upto:
prime = True
for i in range(2, num):
if (num % i == 0):
prime = False
if (prime):
print num,
num = num + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment