summaryrefslogtreecommitdiff
path: root/Problem14.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 /Problem14.py
Initial CommitHEADmaster
Diffstat (limited to 'Problem14.py')
-rw-r--r--Problem14.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Problem14.py b/Problem14.py
new file mode 100644
index 0000000..f7a93b3
--- /dev/null
+++ b/Problem14.py
@@ -0,0 +1,17 @@
+def sequence(x):
+ count = 1
+ while x > 1:
+ if(x%2 == 0):
+ x=x/2
+ else:
+ x=(x*3)+1
+ count+=1
+ return count
+print(sequence(13))
+maxval, maxcount = 0,0
+for x in range(1000000,100000,-1):
+ currentSequence = sequence(x)
+ if currentSequence > maxcount:
+ maxcount = currentSequence
+ maxval = x
+ print(maxval,"with max sequence count of:",maxcount) \ No newline at end of file