Skip to content

Instantly share code, notes, and snippets.

Created July 9, 2014 02:27
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 anonymous/79221d59a836e57ff98c to your computer and use it in GitHub Desktop.
Save anonymous/79221d59a836e57ff98c to your computer and use it in GitHub Desktop.
def findPrimes(x):
numbers = [0]*x
char = 0
for i in range(2,x):
#prime number
if numbers[i] != 1:
char += 2 ** (i % 8 -1)
yield i
#deleting primes from numbers
for j in range(i,x,i):
numbers[j] = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment