diff options
Diffstat (limited to 'challenge-174/sgreen/python')
| -rwxr-xr-x | challenge-174/sgreen/python/ch-1.py | 25 |
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() |
