From fdd800775ca52e7600d78f38e5345a5197cc086c Mon Sep 17 00:00:00 2001 From: Andrew Shitov Date: Fri, 4 Dec 2020 09:17:37 +0100 Subject: Week 89 Issue 1 --- challenge-089/ash/python/ch-1.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 challenge-089/ash/python/ch-1.py (limited to 'challenge-089/ash/python/ch-1.py') diff --git a/challenge-089/ash/python/ch-1.py b/challenge-089/ash/python/ch-1.py new file mode 100644 index 0000000000..b962d9c617 --- /dev/null +++ b/challenge-089/ash/python/ch-1.py @@ -0,0 +1,14 @@ +# Test run: +# $ python3 ch-1.py 100 +# 13015 + +import sys, math + +n = 3 if len(sys.argv) == 1 else int(sys.argv[1]) + +s = 0 +for x in range(1, n + 1): + for y in range(x + 1, n + 1): + s += math.gcd(x, y) + +print(s) -- cgit