From 9b40c70b2c53254e91f0a3a19c68c554fa19731e Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Tue, 4 May 2010 13:02:17 +0000 Subject: [PATCH] Problem 034 git-svn-id: file:///srv/svn/euler@61 e5f4c3ec-3c0c-11df-b522-21efaa4426b5 --- e034.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 e034.py diff --git a/e034.py b/e034.py new file mode 100644 index 0000000..9916fc5 --- /dev/null +++ b/e034.py @@ -0,0 +1,20 @@ +import math + +def sum_factorial(n): + s = str(n) + total = 0 + for c in s: + total = total + math.factorial(int(c)) + return total + +MAX = 100000 + +if __name__ == '__main__': + total = 0 + i = 2 + while i <= MAX: + i = i + 1 + if i == sum_factorial(i): + print i + total = total + i + print 'Total:', total