aboutsummaryrefslogtreecommitdiff
path: root/challenge-153/laurent-rosenfeld/python/ch-2.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-153/laurent-rosenfeld/python/ch-2.py')
-rw-r--r--challenge-153/laurent-rosenfeld/python/ch-2.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/challenge-153/laurent-rosenfeld/python/ch-2.py b/challenge-153/laurent-rosenfeld/python/ch-2.py
new file mode 100644
index 0000000000..6468fa9f27
--- /dev/null
+++ b/challenge-153/laurent-rosenfeld/python/ch-2.py
@@ -0,0 +1,15 @@
+fact = [1] * 10
+for n in range (1, 10):
+ fact[n] = n * fact[n - 1]
+
+def is_factorion (input):
+ sum = 0
+ n = str(input)
+ for i in range (0, len(n)):
+ sum = sum + fact[int(n[i])]
+
+ return input == sum
+
+for n in range(1, 50000):
+ if is_factorion(n):
+ print(n)