Skip to content

Instantly share code, notes, and snippets.

@FGFW
Created October 8, 2016 05:12
Show Gist options
  • Save FGFW/f8e0348e992a099f07f23153d6c6d38a to your computer and use it in GitHub Desktop.
Save FGFW/f8e0348e992a099f07f23153d6c6d38a to your computer and use it in GitHub Desktop.
projecteuler.net/problem=14
#2016年10月8日 11:17:15 codegay
#https://projecteuler.net/problem=14
d = {}
for s in range(2,1000000):
n = s
c = 0
while n >1:
n = [n//2,3*n+1][n%2]
c +=1
d.update({s:c})
print(max(d.items(),key=lambda x: x[1]))
@FGFW
Copy link
Author

FGFW commented Oct 8, 2016

(837799, 524)
[Finished in 102.3s]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment