aboutsummaryrefslogtreecommitdiff
path: root/challenge-174/sgreen/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-174/sgreen/python/ch-1.py')
-rwxr-xr-xchallenge-174/sgreen/python/ch-1.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/challenge-174/sgreen/python/ch-1.py b/challenge-174/sgreen/python/ch-1.py
new file mode 100755
index 0000000000..cf3ae3c075
--- /dev/null
+++ b/challenge-174/sgreen/python/ch-1.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+
+def is_disarium(n):
+ sum = 0
+
+ for count, value in enumerate(str(n)):
+ sum += int(value) ** (count+1)
+
+ return sum == n
+
+
+def main():
+ solutions = []
+ number = 0
+
+ while len(solutions) < 19:
+ if is_disarium(number):
+ solutions.append(number)
+ number += 1
+
+ print(*solutions, sep=', ')
+
+
+if __name__ == '__main__':
+ main()