Esempio n. 1
0
def pe005():
    """Find the smallest positive number that is divisible by range[1, 20]"""
    from tools import isDivisibleBy

    num = 2520
    while not reduce(lambda x, y: isDivisibleBy(num, y) and x,
                     xrange(11, 21),
                     True):
        num += 2520

    return num
Esempio n. 2
0
def pe001():
    """Find the sum of all multiples of 3 or 5 below 1000"""
    from tools import isDivisibleBy

    return sum(filter(lambda x: isDivisibleBy(x, 3) or isDivisibleBy(x, 5),
                      xrange(0, 1000)))