Skip to content

Commit

Permalink
Start of a ric polynomial siever
Browse files Browse the repository at this point in the history
  • Loading branch information
dave-andersen committed Mar 19, 2014
1 parent b1aa0a5 commit c269699
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions explain/examples/ric_siever.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/python

import basic_sieve_e

primorial = 2*3*5*7 # This equals 210

isCandidate = [True] * primorial

for i in [2, 3, 5, 7]:
ni = i
while ni < (primorial+16):
for offset in [0, 4, 6, 10, 12, 16]:
if (ni-offset > 0 and ni-offset < primorial):
isCandidate[ni-offset] = False
ni += i

for i in range(3, primorial):
if isCandidate[i]:
print i

0 comments on commit c269699

Please sign in to comment.