Skip to content

Instantly share code, notes, and snippets.

@clementi
Created February 10, 2011 03:31
Show Gist options
  • Save clementi/819885 to your computer and use it in GitHub Desktop.
Save clementi/819885 to your computer and use it in GitHub Desktop.
Project Euler Problem #56 Solution
from itertools import *
pairs = product(range(1, 100), range(1, 100))
exponentials = imap(lambda pair: pair[0] ** pair[1], pairs)
strings = imap(lambda exponential: str(exponential), exponentials)
sums = imap(lambda string: sum(map(lambda digit: int(digit), string)), strings)
print max(sums)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment