Exemplo n.º 1
0
import euler_ops
import sys
import math

number_max = 20
increment = euler_ops.mult_primes(number_max)
count = increment
min_divisor = math.floor(number_max / 2)
divisor = 0
is_evenly_divisible = False
current_divisible = True
while is_evenly_divisible is False:
    current_divisible = True
    divisor = min_divisor
    while current_divisible is True and divisor <= number_max:
        if count % divisor is not 0:
            current_divisible = False
        divisor += 1
    if current_divisible is True:
        is_evenly_divisible = True
    else:
        count += increment

euler_ops.print_answer(count, sys.argv)
Exemplo n.º 2
0
import euler_ops
import sys

number = 2000000
answer = euler_ops.sum_primes(number)

euler_ops.print_answer(answer, sys.argv)
Exemplo n.º 3
0
import euler_ops
import sys

sum_mult_5_3 = (euler_ops.sum_multiples(0, 1000, 3)
               + euler_ops.sum_multiples(0, 1000, 5)
               - euler_ops.sum_multiples(0, 1000, 15))
euler_ops.print_answer(sum_mult_5_3, sys.argv)
Exemplo n.º 4
0
import euler_ops
import sys

largest_prime_factor = euler_ops.largest_prime_factor(600851475143)
euler_ops.print_answer(largest_prime_factor, sys.argv)