1
1
"""
2
2
Project Euler Problem: https://projecteuler.net/problem=95
3
3
4
- An amicable chain is a sequence of numbers where each number is the sum of the
5
- proper divisors of the previous one, and the chain eventually returns to the
6
- starting number. The problem is to find the smallest member of the longest
4
+ An amicable chain is a sequence of numbers where each number is the sum of the
5
+ proper divisors of the previous one, and the chain eventually returns to the
6
+ starting number. The problem is to find the smallest member of the longest
7
7
amicable chain under a given limit.
8
8
9
- In this implementation, we aim to identify all amicable chains and find the
10
- one with the maximum length, while also returning the smallest member of that
9
+ In this implementation, we aim to identify all amicable chains and find the
10
+ one with the maximum length, while also returning the smallest member of that
11
11
chain.
12
12
"""
13
13
14
- < << << << HEAD
15
- == == == =
16
-
17
- def sum_of_proper_divisors (number : int ) -> int :
18
- """Calculate the sum of proper divisors of the given number.
19
- >>>>>>> 89e57b63f62908f575161ca2c077f02c189a363c
20
14
21
15
def sum_of_proper_divisors (n ):
22
16
"""Calculate the sum of proper divisors of n."""
@@ -34,12 +28,6 @@ def sum_of_proper_divisors(n):
34
28
35
29
return total
36
30
37
- <<<<<<< HEAD
38
- =======
39
-
40
- def find_longest_amicable_chain(limit: int) -> int:
41
- """ Find the smallest member of the longest amicable chain under a given limit .
42
- > >> >> >> 89e57 b63f62908f575161ca2c077f02c189a363c
43
31
44
32
def find_longest_amicable_chain (limit ):
45
33
"""Find the smallest member of the longest amicable chain under a given limit."""
@@ -78,10 +66,6 @@ def find_longest_amicable_chain(limit):
78
66
return (
79
67
min (longest_chain ) if longest_chain else None
80
68
) # Return the smallest member of the longest chain
81
- < << << << HEAD
82
- == == == =
83
-
84
- >> >> >> > 89e57 b63f62908f575161ca2c077f02c189a363c
85
69
86
70
87
71
def solution ():
0 commit comments