Skip to content

Commit cfd347c

Browse files
Update sol1.py
1 parent b22afa5 commit cfd347c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

project_euler/problem_095/sol1.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def generate_primes(num: int) -> list[int]:
6464
return [prime for prime, is_prime in enumerate(are_primes) if is_prime]
6565

6666

67-
def multiply(chain, primes, prime, prev_n, n_max, prev_sum, primes_d):
67+
def multiply(chain: list, primes: set[int], prime: int, prev_n: int, n_max: int, prev_sum: int, primes_d: dict[int, int]) -> None:
6868
"""
6969
Run over all prime combinations to generate non-prime numbers.
7070
@@ -123,14 +123,14 @@ def solution(max_num: int = 1000000) -> int:
123123
12496
124124
"""
125125

126-
primes = generate_primes(n_max)
127-
chain = [0] * (n_max + 1)
126+
primes = generate_primes(max_num)
127+
chain = [0] * (max_num + 1)
128128
for p in primes:
129-
if p * p > n_max:
129+
if p * p > max_num:
130130
break
131-
multiply(chain, primes, p, 1, n_max, 0, {})
131+
multiply(chain, primes, p, 1, max_num, 0, {})
132132

133-
chain_start, _ = find_longest_chain(chain, n_max)
133+
chain_start, _ = find_longest_chain(chain, max_num)
134134
return chain_start
135135

136136

0 commit comments

Comments
 (0)