summaryrefslogtreecommitdiff
path: root/Problem55.py
diff options
context:
space:
mode:
authorJoshua Drake <joshua.drake@ditchwitch.com>2023-04-07 08:13:49 -0500
committerJoshua Drake <joshua.drake@ditchwitch.com>2023-04-07 08:13:49 -0500
commit1161f9a034de06a63538e3a9a0b7717098c744d9 (patch)
tree55bb842b2daa4f096eb7916a8d3630426fc1c376 /Problem55.py
Initial CommitHEADmaster
Diffstat (limited to 'Problem55.py')
-rw-r--r--Problem55.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Problem55.py b/Problem55.py
new file mode 100644
index 0000000..2ce11cb
--- /dev/null
+++ b/Problem55.py
@@ -0,0 +1,18 @@
+def isPalindrome(n):
+ if n == int(str(n)[::-1]): return True
+ return False
+def isLychrel(n):
+ revn = int(str(n)[::-1])
+ n += revn
+ count = 0
+ while isPalindrome(n) == False:
+ if count >= 50: return True
+ revn = int(str(n)[::-1])
+ n += revn
+ count+=1
+ return False
+
+count = 0
+for x in range(1,10000):
+ if isLychrel(x): count+=1
+print(count) \ No newline at end of file