def findSmallestMultiple(): to_be_multiplied = [] # list of numbers to be multiplied to get the smallest multiple i.e. the result for number in range(2,21): prime_fact_list = Common.findPrimeFactors(number) # express the number in terms of its prime factors prime_factor_count = {fact:prime_fact_list.count(fact) for fact in prime_fact_list } # keep a count of the number of times a prime number appears as a factor for a number for key in prime_factor_count: if key not in to_be_multiplied: # check if the prime factor is already in the to_be_multiplied list. If not, add it. to_be_multiplied.append(key) else: if prime_factor_count[key] > to_be_multiplied.count(key): to_be_multiplied.append(key) return Common.computeProductOfAList(to_be_multiplied)