def sum_of_even_fibonacci_numbers(limit): """ finds the sum of even Fibonacci numbers up to some limit, inclusive limit (int): max number returns (int): sum """ even_fibs = [] for fib in gen_fibonacci(): if fib > limit: break elif is_even(fib): even_fibs.append(fib) #print("+ " + str(fib)) else: continue return sum(even_fibs)
def is_goldbach_number(number): """ >>> is_goldbach_number(9) True >>> is_goldbach_number(15) True >>> is_goldbach_number(5777) False """ primes = Primes(number) for prime in primes: step = number - prime if is_even(step): step = sqrt(step / 2) if is_integer(step): return True return False