In [8]:
"""
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 positive number that is evenly divisible by all of the numbers from 1 to 20?
"""

def findMinDivisibleUpToX(x):
    """Returns minimum evenly divisible number for all numbers up to x."""
    
    # This appears to be a patheticly weak solution, but it does work. Should probably think it over, though. 
    # A better way might be to sieve x and then multiply the required numbers, like this: 
    # 20, 10, 5, 4, 2; 19; 18, 9, 6, 3; 17; 16, 8; 15; 14, 7; 13; 12; 11; 1. 
    
    i = 1
    divisors = range(1,x+1)
    
    while(True):
        evenlyDivisable = 1
        for d in divisors:
            if(i%d != 0):
                evenlyDivisable = 0
                break
        if(evenlyDivisable):
            return i
        i = i+1

In [16]:
findMinDivisibleUpToX(20)


Out[16]:
232792560