#2520 is the smallest number that can be divided #by each of the numbers from 1 to 10 without any remainder. #What is the smallest number that is evenly #divisible by all of the numbers from 1 to 20 number = 0 found = False #starting value of 20 x 19 # because we need a number which # is both a multiple of 19 and 20 # and only numbers that are # multiples of 20 x 19 # fullfill this requirement curNum = 20 * 19 foundCur = False #only need to check 20-11, because all #numbers 10-1 equally divide the numbers #already in the list. checknumbers = [20,19,18,17,16,15,14,13,12,11] while not found: foundCur = True for i in checknumbers: if curNum % i > 0: foundCur = False break if foundCur: number = curNum found = True #only check multiples of 20 x 19 # because no other numbers will # be multiples of both 20 and 19 curNum += 20 * 19 print "The smallest number that can be evenly divided by the numbers 1-20 is %d " % (number,)