Adopted new convention from template
This commit is contained in:
parent
fbaeeed8f3
commit
4a89c7613c
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Created on 7 Jan 2018
|
||||
|
||||
@ -11,6 +11,7 @@ https://projecteuler.net/problem=14
|
||||
|
||||
from utils import timeit
|
||||
|
||||
|
||||
def chain_length(n, terms):
|
||||
length = 0
|
||||
while n != 1:
|
||||
@ -24,6 +25,7 @@ def chain_length(n, terms):
|
||||
length += 1
|
||||
return length
|
||||
|
||||
|
||||
@timeit("Problem 14")
|
||||
def compute():
|
||||
"""
|
||||
@ -46,6 +48,7 @@ def compute():
|
||||
|
||||
NOTE: Once the chain starts the terms are allowed to go above one million.
|
||||
"""
|
||||
|
||||
ans = 0
|
||||
limit = 1_000_000
|
||||
score = 0
|
||||
@ -55,9 +58,9 @@ def compute():
|
||||
if terms[i] > score:
|
||||
score = terms[i]
|
||||
ans = i
|
||||
|
||||
return ans
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
print(f"Result for Problem 14: {compute()}")
|
||||
print(f"Result for Problem 14 is {compute()}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user