Skip to content

Instantly share code, notes, and snippets.

@Roasbeef
Created March 28, 2012 17:49
Show Gist options
  • Save Roasbeef/2228671 to your computer and use it in GitHub Desktop.
Save Roasbeef/2228671 to your computer and use it in GitHub Desktop.
Project Euler Problem #16 Solution
#Sum of digits of 2^1000
from functools import reduce
#Solution Number:1
reduce(lambda a,b: a+b, [int(x) for x in str(2**1000)])
#Solution Number:2
sum([int(x) for x in str(2**1000)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment