コード例 #1
0
ファイル: basic_ric.py プロジェクト: romankosoj/fastrie
#!/usr/bin/python

import basic_sieve_e
import sys

do_output = False

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

count = 0

for candidate in basic_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 (basic_sieve_e.sieve_is_valid_pow(candidate)):
            count += 1
            if do_output:
                print candidate

print "Total of ", count, " prime sextuplets"
コード例 #2
0
ファイル: ric_gen.py プロジェクト: romankosoj/fastrie
            if val > N:
                break
            if not candidate_killed_by(val, prime):
                new_offsets.append(val)
        base += primorial

    return new_offsets


primorial_max = 29

primorial_start = 7
primorial = 210  # Start with the one we figured out earlier: 2*3*5*7
offsets = [97]

for i in basic_sieve_e.genprime(primorial_max):
    if i <= primorial_start:
        continue

    offsets = add_next_prime(offsets, i, primorial)
    primorial *= i

count = 0
for o in offsets:
    if fermat_test.fermat_is_valid_pow(o):
        count += 1
        if do_output:
            print o

print "Total of ", count, " prime sextuplets"
コード例 #3
0
ファイル: ric_gen.py プロジェクト: AHYIOcoin/fastrie
            if val > N:
                break
            if not candidate_killed_by(val, prime):
                new_offsets.append(val)
        base += primorial

    return new_offsets


primorial_max = 29

primorial_start = 7
primorial = 210  # Start with the one we figured out earlier: 2*3*5*7
offsets = [97]

for i in basic_sieve_e.genprime(primorial_max):
    if i <= primorial_start:
        continue

    offsets = add_next_prime(offsets, i, primorial)
    primorial *= i

count = 0
for o in offsets:
    if fermat_test.fermat_is_valid_pow(o):
        count += 1
        if do_output:
            print o

print "Total of ", count, " prime sextuplets"
コード例 #4
0
ファイル: basic_ric.py プロジェクト: AHYIOcoin/fastrie
#!/usr/bin/python

import basic_sieve_e
import sys
do_output = False

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

count = 0

for candidate in basic_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 (basic_sieve_e.sieve_is_valid_pow(candidate)):
            count += 1
            if do_output:
                print candidate

print "Total of ", count, " prime sextuplets"