aboutsummaryrefslogtreecommitdiff
path: root/challenge-174/eric-cheung/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-174/eric-cheung/python/ch-1.py')
-rwxr-xr-xchallenge-174/eric-cheung/python/ch-1.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/challenge-174/eric-cheung/python/ch-1.py b/challenge-174/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..6c56148e57
--- /dev/null
+++ b/challenge-174/eric-cheung/python/ch-1.py
@@ -0,0 +1,32 @@
+
+##
+
+def IsDisariumNum (nInput):
+
+ strInput = str(nInput)
+ nCheckSum = 0
+
+ for nIndex in range(0, len(strInput)):
+ nCheckSum = nCheckSum + int(strInput[nIndex]) ** (nIndex + 1)
+
+ if nCheckSum == nInput:
+ return True
+
+ return False
+
+
+arrDisariumNum = []
+
+
+nLoop = 0
+while len(arrDisariumNum) < 19:
+
+ if IsDisariumNum(nLoop):
+ arrDisariumNum.append(nLoop)
+
+ nLoop = nLoop + 1
+
+
+print (arrDisariumNum)
+## Result: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 89, 135, 175, 518, 598, 1306, 1676, 2427, 2646798]
+