#!/usr/bin/env python # Problem 1: # # If we list all the natural numbers below 10 that # are multiples of 3 or 5, we get 3, 5, 6 and 9. # # The sum of these multiples is 23. # # Find the sum of all the multiples of 3 or 5 below 1000. import decorators def check_divisibility(num, dict_multiples: dict) -> bool: dummy = 1 for m in dict_multiples: dummy *= num%m if dummy == 0: return True else: return False @decorators.function_timer def main(): multiples = {3,5} sumval = 0 for n in range(1000): r = check_divisibility(n,multiples) if r: sumval += n print(sumval) main()