Skip to content

Commit

Permalink
Add python script to generate the bits needed for the prime generator.
Browse files Browse the repository at this point in the history
  • Loading branch information
erbridge authored and benlaurie committed Jun 1, 2014
1 parent c09ec5d commit 8a12085
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tools/primes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
primes = [2, 3, 5, 7]
safe = True

muliplier = 1
for p in primes:
muliplier *= p

offsets = []
for x in range(3, muliplier + 3, 2):
prime = True
for p in primes:
if not x % p or (safe and not ((x - 1) / 2) % p):
prime = False
break

if prime:
offsets.append(x)

print(offsets)
print(len(offsets))
print(muliplier)

0 comments on commit 8a12085

Please sign in to comment.