コード例 #1
0
def countPrimes(a, b):
    count = 0
    for n in eulermath.infinite_range(0):

        possible_prime = (n * n) + (a * n) + b
        if (eulermath.PrimesHelper().is_prime(possible_prime)):
            count += 1
        else:
            return count
コード例 #2
0
def run():
    result = -1
    for i in eulermath.infinite_range(9, 2):
        if (not f(i)):
            result = i
            break

    print result
    #Report Completion.
    eulersupport.write_output(result)
コード例 #3
0
ファイル: euler46.py プロジェクト: N2OMatt/ProjectEuler
def run():
    result = -1;
    for i in eulermath.infinite_range(9, 2):
        if(not f(i)):
            result = i;
            break;

    print result;
    #Report Completion.
    eulersupport.write_output(result);
コード例 #4
0
ファイル: euler44.py プロジェクト: N2OMatt/ProjectEuler
def run():
    for j in eulermath.infinite_range(1):
        Pj = eulermath.pentagonal_number(j)

        for k in xrange(1, j):
            Pk = eulermath.pentagonal_number(k)
            s = Pj + Pk
            d = Pj - Pk

            if eulermath.is_pentagonal_number(s) and eulermath.is_pentagonal_number(d):
                eulersupport.write_output(d)
                return
コード例 #5
0
def run():
    for j in eulermath.infinite_range(1):
        Pj = eulermath.pentagonal_number(j);

        for k in xrange(1, j):
            Pk = eulermath.pentagonal_number(k);
            s = Pj + Pk;
            d = Pj - Pk;

            if(eulermath.is_pentagonal_number(s) and eulermath.is_pentagonal_number(d)):
                eulersupport.write_output(d);
                return;
コード例 #6
0
def run():
    factors_count = 4
    consecutive_count = 4
    consecutive_list = []
    result = None

    for i in eulermath.infinite_range(0):
        print i
        factors = eulermath.prime_factors(i)

        if (len(factors) == factors_count):
            consecutive_list.append(i)
        else:
            consecutive_list = []

        if (len(consecutive_list) == consecutive_count):
            result = consecutive_list[0]
            break

    eulersupport.write_output(result)