Skip to content

Instantly share code, notes, and snippets.

@codyhanson
Created June 20, 2013 21:42
Show Gist options
  • Save codyhanson/5826941 to your computer and use it in GitHub Desktop.
Save codyhanson/5826941 to your computer and use it in GitHub Desktop.
A really inefficient way to compute prime numbers.
#! /usr/bin/env python
curnum = 2
nums = []
while True:
prime = True
for num in nums:
if curnum % num == 0:
prime = False
break
if prime is True:
print curnum
nums.append(curnum)
curnum = curnum + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment