We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0c8cf8e commit cde6389Copy full SHA for cde6389
2 files changed
project_euler/problem_136/__init__.py
project_euler/problem_136/sol1.py
@@ -0,0 +1,23 @@
1
+N = 50000000
2
+
3
4
+def solution(n_limit: int = N) -> int:
5
+ n_sol = [0] * n_limit
6
7
+ for delta in range(1, (n_limit + 1) // 4):
8
+ for y in range(4 * delta - 1, delta, -1):
9
+ n = y * (4 * delta - y)
10
+ if n >= n_limit:
11
+ break
12
+ n_sol[n] += 1
13
14
+ ans = 0
15
+ for i in range(n_limit):
16
+ if n_sol[i] == 1:
17
+ ans += 1
18
19
+ return ans
20
21
22
+if __name__ == "__main__":
23
+ print(f"{solution() = }")
0 commit comments