Exemple #1
0
def solve002(limit, start_with_two_ones):
    fibonacci = NumberTheory.fibonacci_under(limit, start_with_two_ones)
    even_fibonacci = list()
    for num in fibonacci:
        if NumberTheory.is_factor_of(2, num):
            even_fibonacci.append(num)
    return sum(even_fibonacci)
Exemple #2
0
def solve007(limit):
    return max(NumberTheory.first_primes(limit))
Exemple #3
0
def solve005(limit):
    return NumberTheory.smallest_multiple(limit)
Exemple #4
0
def solve003(limit):
    factors = NumberTheory.prime_factors_of(limit)
    return max(factors)
Exemple #5
0
def solve001(factors, multiple):
    return NumberTheory.sum_of_multiples_under(factors, multiple)
Exemple #6
0
def solve024(n):
    list_ = list(range(10))
    permutation = NumberTheory.nth_permutation(n, list_)
    permutation = [str(x) for x in permutation]
    return "".join(permutation)
Exemple #7
0
def solve021(num):
    divisors = NumberTheory.proper_divisors(num)
    return sum(divisors)
Exemple #8
0
def solve014(limit):
    iterations = NumberTheory.collatz_iterations_under(limit)
    return General.key_with_max_value(iterations)
Exemple #9
0
def solve012(limit):
    num = 2
    while NumberTheory.num_factors_of(Basic.sum_up_to(num)) <= limit:
        num += 1
    return Basic.sum_up_to(num)
Exemple #10
0
def solve010(limit):
    primes = NumberTheory.primes_under(limit)
    return sum(primes)