Ejemplo n.º 1
0
#!/usr/bin/python

import faster_sieve_e
import sys

do_output = False

N = 10000000
if len(sys.argv) > 1:
    N = int(sys.argv[1])

count = 0

for candidate in faster_sieve_e.genprime(N):
    # Skip the first spots until our sieve will have eliminated
    # invalid candiates.  Only needed because we're starting small.
    if (candidate > 17 and candidate < N - 17):
        if (faster_sieve_e.sieve_is_valid_pow(candidate)):
            count += 1
            if do_output:
                print candidate

print "Total of ", count, " prime sextuplets"
Ejemplo n.º 2
0
#!/usr/bin/python

import faster_sieve_e
import fermat_test
import array
import sys
import invert_mod

# Target from first block in the Riecoin blockchain
T=0x801A2F60588BF10BB614D6796A726025F88C7156E3FBDF68685FC0617F4266358C0000000000
print T
tuple_offsets = [0, 4, 6, 10, 12, 16]
Pn = 7
primorial = 1
for p in faster_sieve_e.genprime(Pn):
    primorial *= p

offset = 97 # Only works up to Pn < 97!

# Step 1:  Round up to the nearest multiple of our primorial
# Step 2:  Add in the offset

remainder = int(T % primorial) #  Remainder after division
round_up_amount = primorial - remainder
start_candidate = T + round_up_amount
start_candidate += offset

count = 0

# Step 3:  Generate a sieve relative to the primorial.
sievesize = 1024*512
Ejemplo n.º 3
0
#!/usr/bin/python

import faster_sieve_e
import sys

do_output = False

N=10000000
if len(sys.argv) > 1:
    N = int(sys.argv[1])

count = 0

for candidate in faster_sieve_e.genprime(N):
    # Skip the first spots until our sieve will have eliminated
    # invalid candiates.  Only needed because we're starting small.
    if (candidate > 17 and candidate < N-17):
        if (faster_sieve_e.sieve_is_valid_pow(candidate)):
            count += 1
            if do_output:
                print candidate

print "Total of ", count, " prime sextuplets"
Ejemplo n.º 4
0
#!/usr/bin/python

import faster_sieve_e
import fermat_test
import array
import sys
import invert_mod

# Target from first block in the Riecoin blockchain
T = 0x801A2F60588BF10BB614D6796A726025F88C7156E3FBDF68685FC0617F4266358C0000000000
print T
tuple_offsets = [0, 4, 6, 10, 12, 16]
Pn = 7
primorial = 1
for p in faster_sieve_e.genprime(Pn):
    primorial *= p

offset = 97  # Only works up to Pn < 97!

# Step 1:  Round up to the nearest multiple of our primorial
# Step 2:  Add in the offset

remainder = int(T % primorial)  #  Remainder after division
round_up_amount = primorial - remainder
start_candidate = T + round_up_amount
start_candidate += offset

count = 0

# Step 3:  Generate a sieve relative to the primorial.
sievesize = 1024 * 512