From 44bcd3ae0c35b887bd579e60c17198360f3497c3 Mon Sep 17 00:00:00 2001 From: Abigail Date: Tue, 30 Nov 2021 20:04:35 +0100 Subject: Solutions week 141 --- challenge-141/abigail/python/ch-1.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 challenge-141/abigail/python/ch-1.py (limited to 'challenge-141/abigail/python/ch-1.py') diff --git a/challenge-141/abigail/python/ch-1.py b/challenge-141/abigail/python/ch-1.py new file mode 100644 index 0000000000..cd4c0b5d3b --- /dev/null +++ b/challenge-141/abigail/python/ch-1.py @@ -0,0 +1,30 @@ +#!/opt/local/bin/python + +# +# See ../README.md +# + +# +# Run as: python ch-1.py +# + +import math + +count = 10 +nr_of_divisors = 8 + +n = 0 +while count > 0: + n = n + 1 + s = math . floor (math . sqrt (n)) + if n == s * s: + continue + c = 0 + for d in range (1, s + 1): + if n % d == 0: + c = c + 2 + if c > nr_of_divisors: + break + if c == nr_of_divisors: + print (n) + count = count - 1 -- cgit