From 42907eeaba5efd46bd2fbf837ded9a368bb51e70 Mon Sep 17 00:00:00 2001 From: Felix Martin Date: Mon, 19 Apr 2021 11:55:37 -0400 Subject: [PATCH] Solve problem 97 --- README.md | 2 +- python/e091.py | 32 ++++++++++++++++++++++++++++++++ python/e097.py | 16 ++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 python/e091.py create mode 100644 python/e097.py diff --git a/README.md b/README.md index f06e767..4eb42ec 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,6 @@ Project Euler discourages sharing solutions to the problem. Since there are plenty solutions out there on the internet I violate this rule for now. My goal -for know is to finish one hundred problems. After that I might change the +for now is to finish one hundred problems. After that I might change the repository to private. diff --git a/python/e091.py b/python/e091.py new file mode 100644 index 0000000..848b903 --- /dev/null +++ b/python/e091.py @@ -0,0 +1,32 @@ + + +def euler_091(): + n = 2 + qs = [(x, y) + for x in range(n + 1) + for y in range(n + 1)] + + def count_possible_right_triangles(q): + o = (0, 0) + if o == q: + return 0 + + ps = [(x, y) + for x in range(n + 1) + for y in range(q[0], n + 1)] + for p in ps: + if q == p: + continue + print(o, q, p) + + return 0 + + s = sum(map(count_possible_right_triangles, qs)) + return s + + + +if __name__ == "__main__": + solution = euler_091() + print("e091.py: " + str(solution)) + assert(solution == 0) diff --git a/python/e097.py b/python/e097.py new file mode 100644 index 0000000..bef9db2 --- /dev/null +++ b/python/e097.py @@ -0,0 +1,16 @@ + +def euler_097(): + mod = 10**10 # we want the last ten digits + s = 1 + for _ in range(7830457): + s = (s * 2) % mod + s = (28433 * s) % mod + s = s + 1 + return s + + +if __name__ == "__main__": + solution = euler_097() + print("e097.py: " + str(solution)) + assert(solution == 8739992577) +