project欧拉第五题

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?

寻找能被1-20整除的最小数

 

答案:232792560

python code:

   print  reduce(lambda x,y:x*y , [x**y for x in  reduce(lambda l,y:not 0 in map(lambda x:y % x, l) and l+[y] or l,xrange(2,21), []) for y in xrange(1,20) if x**y<=20<x**(y+1)])

你可能感兴趣的:(python)