'''
Created on 13/07/2013

@author: luke
'''
# http://projecteuler.net/problem=1
def mults_of_ns(mults=[1], limit=1000):
    """
    returns the sum of all the values that are multiples of ns up to limit
    """
    return sum(set([val for val in range(limit) for arg in mults if val%arg==0]))

# http://projecteuler.net/problem=2
def listSolve(n, maxNum=4000000):
    def __even(n):
        return n % 2 == 0
    l = [1] * 3
    total = 0
    for i in range(2, n):
        loc = i % 3
        l[loc] = l[loc-1] + l[loc-2]
        if l[loc] > maxNum: break
        if __even(l[loc]):
            total = total + l[loc]
    return total

def int_while(n, maxNum=4000000):
    def __even(n):
        return n % 2 == 0
    first = second = 1
    total = count = 0
    while count < n:
        third = first + second
        if third > maxNum: break
        if __even(third):
            total = total + third
        first = second
        second = third
    return total

def intSolve(n, maxNum=4000000):
    def __even(n):
        return n % 2 == 0
    def __generateNums(n, maxNum):
        first = second = 1
        for i in range(2, n):
            third = first + second
            if third > maxNum: break
            if __even(third):
                yield third
            first = second
            second = third
    return sum(__generateNums(n, maxNum))
        
        

if __name__ == '__main__':
    print("Question One:")
    print(mults_of_ns([3,5],limit=1000))
    n = 100000
    print ("\nQuestion Two:")
    print (listSolve(n))
    print (int_while(n))

@@ -1358,16 +1358,728 @@
 maxNum))
+%0A%0A#http://projecteuler.net/problem=5%0Adef smallest_multiple(div_by):%0A    %22%22%22%0A    2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.%0A    %0A    What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?%0A    %22%22%22%0A    even        = lambda x, y: x %25 y == 0%0A    solved      = False%0A    value       = 232792560%0A    %0A    def check():%0A        for i in range(2,div_by+1):%0A            res     = even(value, i)%0A            if res != True:%0A                return 0%0A        return value%0A    %0A    while not solved:%0A        res     = check()%0A        if res != 0:%0A            return res%0A        else:%0A            value += 20%0A            
 %0A       
@@ -2117,16 +2117,17 @@
 ain__':%0A
+#
     prin
@@ -2141,24 +2141,25 @@
 tion One:%22)%0A
+#
     print(mu
@@ -2187,16 +2187,17 @@
 =1000))%0A
+#
     n = 
@@ -2203,16 +2203,17 @@
  100000%0A
+#
     prin
@@ -2234,16 +2234,17 @@
  Two:%22)%0A
+#
     prin
@@ -2260,16 +2260,17 @@
 lve(n))%0A
+#
     prin
@@ -2282,12 +2282,45 @@
 t_while(n))%0A
+    print(smallest_multiple(40))%0A

smallest multiple