Skip to content

Instantly share code, notes, and snippets.

@iizukak
Created July 21, 2012 13:52
Show Gist options
  • Select an option

  • Save iizukak/3155869 to your computer and use it in GitHub Desktop.

Select an option

Save iizukak/3155869 to your computer and use it in GitHub Desktop.
Project Euler Problem 20
#project euler problem 20
#http://projecteuler.net/problem=20
#auther @iizukak
#100!の各桁を足す問題
def fact(n):
if n == 2:
return 2
else:
return n * fact(n-1)
a = fact(100)
L = map((lambda x: int(x)), str(a))
ans = 0
for i in range(len(L)):
ans += L[i]
print ans
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment