Skip to content

Commit b22afa5

Browse files
Update sol1.py
1 parent bded104 commit b22afa5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

project_euler/problem_095/sol1.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ def multiply(chain, primes, prime, prev_n, n_max, prev_sum, primes_d):
8686
multiply(chain, primes, p, number, n_max, new_sum, primes_d.copy())
8787

8888

89-
def find_longest_chain(chain, n_max):
89+
def find_longest_chain(chain: list[int], max_num: int) -> tuple[int, int]:
9090
"""
91-
Finds the smallest element and length of longest chain
91+
Finds the greatest element and length of longest chain
9292
9393
>>> find_longest_chain([0, 0, 0, 0, 0, 0, 6], 6)
9494
(6, 1)
@@ -101,7 +101,7 @@ def find_longest_chain(chain, n_max):
101101
length = 1
102102
el = chain[i]
103103
visited = {i}
104-
while el > 1 and el <= n_max and el not in visited:
104+
while el > 1 and el <= max_num and el not in visited:
105105
length += 1
106106
visited.add(el)
107107
el = chain[el]
@@ -113,9 +113,9 @@ def find_longest_chain(chain, n_max):
113113
return elem_max, length_max
114114

115115

116-
def solution(n_max: int = 1000000) -> int:
116+
def solution(max_num: int = 1000000) -> int:
117117
"""
118-
Runs the calculation for numbers <= n_max.
118+
Runs the calculation for numbers <= `max_num`.
119119
120120
>>> solution(10)
121121
6

0 commit comments

Comments
 (0)