Skip to content

Commit 021ef25

Browse files
Update sol1.py
1 parent ab9ae2e commit 021ef25

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

project_euler/problem_095/sol1.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,6 @@
3131
from math import isqrt, prod
3232

3333

34-
def sum_primes(primes_degrees: dict[int, int], num: int) -> int:
35-
"""
36-
Calculates the sum of factors from all prime exponents.
37-
38-
>>> sum_primes(primes_degrees={2: 1, 3: 1}, num=6)
39-
6
40-
"""
41-
return (
42-
prod(
43-
(prime ** (degree + 1) - 1) // (prime - 1)
44-
for prime, degree in primes_degrees.items()
45-
)
46-
- num
47-
)
48-
49-
5034
def generate_primes(max_prime: int) -> list[int]:
5135
"""
5236
Calculates the list of primes up to and including `max_prime`.
@@ -103,9 +87,6 @@ def multiply(
10387
new_sum = prev_sum * min_prime + (prev_sum + prev_num) * (min_prime - 1) // (
10488
min_prime**min_prime_degree - 1
10589
)
106-
assert new_sum == sum_primes(primes_degrees=primes_degrees, num=num), (
107-
f"{num} {primes_degrees} {prev_num} {min_prime} {prev_num} {new_sum} {sum_primes(primes_degrees=primes_degrees, num=num)}"
108-
)
10990
chain[num] = new_sum
11091

11192
for prime_idx in range(min_prime_idx, len(primes)):

0 commit comments

Comments
 (0)