aboutsummaryrefslogtreecommitdiff
path: root/challenge-171/walt-mankowski/python
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-171/walt-mankowski/python')
-rw-r--r--challenge-171/walt-mankowski/python/.python-version2
-rw-r--r--challenge-171/walt-mankowski/python/ch-1.py19
2 files changed, 20 insertions, 1 deletions
diff --git a/challenge-171/walt-mankowski/python/.python-version b/challenge-171/walt-mankowski/python/.python-version
index a5c4c76339..c84ccce96a 100644
--- a/challenge-171/walt-mankowski/python/.python-version
+++ b/challenge-171/walt-mankowski/python/.python-version
@@ -1 +1 @@
-3.9.0
+3.10.5
diff --git a/challenge-171/walt-mankowski/python/ch-1.py b/challenge-171/walt-mankowski/python/ch-1.py
new file mode 100644
index 0000000000..90da29528a
--- /dev/null
+++ b/challenge-171/walt-mankowski/python/ch-1.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+def odd_divisors(n):
+ od = [i for i in range(1,n//2+1,2) if n % i == 0]
+ return od
+
+abundant = []
+n = 1
+while len(abundant) < 20:
+ od = odd_divisors(n)
+ if sum(od) > n:
+ abundant.append(n)
+ sum_str = ' + '.join([str(i) for i in od])
+ print(f"{len(abundant):2d}: {sum_str} = {sum(od)} > {n}")
+ n += 2
+print(abundant)
+
+
+