Skip to content

Commit a96ae44

Browse files
committed
amicables solution in python
1 parent be06f8b commit a96ae44

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

math/how_to_prove_it/chap1.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,17 @@ for n in range(1, 30000):
7777
3 5 7
7878
```
7979
up to 30,000 those are the only 2 triplets
80+
81+
7)
82+
```python
83+
small_div_sum = lambda x: sum(n for n in range(1, x) if x%n==0)
84+
amicables = lambda x, y: small_div_sum(x) == y and small_div_sum(y) == x
85+
amicables(220, 284)
86+
amicables(20, 30)
87+
```
88+
89+
--->
90+
```
91+
True
92+
False
93+
```

0 commit comments

Comments
 (0)