diff options
Diffstat (limited to 'challenge-153/laurent-rosenfeld/python')
| -rw-r--r-- | challenge-153/laurent-rosenfeld/python/ch-1.py | 7 | ||||
| -rw-r--r-- | challenge-153/laurent-rosenfeld/python/ch-2.py | 15 |
2 files changed, 22 insertions, 0 deletions
diff --git a/challenge-153/laurent-rosenfeld/python/ch-1.py b/challenge-153/laurent-rosenfeld/python/ch-1.py new file mode 100644 index 0000000000..159f8db710 --- /dev/null +++ b/challenge-153/laurent-rosenfeld/python/ch-1.py @@ -0,0 +1,7 @@ +fact = 1 +left_fact = 1 + +for n in range (1, 11): + print(left_fact) + fact = fact * n + left_fact = left_fact + fact 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) |
