Created
October 8, 2016 05:12
-
-
Save FGFW/f8e0348e992a099f07f23153d6c6d38a to your computer and use it in GitHub Desktop.
projecteuler.net/problem=14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(837799, 524)
[Finished in 102.3s]