Skip to content

Instantly share code, notes, and snippets.

@mutaku
Created May 29, 2013 20:45
Show Gist options
  • Select an option

  • Save mutaku/5673699 to your computer and use it in GitHub Desktop.

Select an option

Save mutaku/5673699 to your computer and use it in GitHub Desktop.
Project Euler Toiling
def multiples(max, div):
results = list()
for i in range(1, max):
if not all(map(lambda x: i % x, div)):
results.append(i)
return results
a = multiples(1000, [3, 5])
sum(a)
# one-liner
sum([x for x in range(1000) if not all(map(lambda y: x % y, [3, 5]))])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment