Skip to content

Commit cde6389

Browse files
committed
Add initial version of file for the Euler project problem 136 solution.
1 parent 0c8cf8e commit cde6389

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

Diff for: project_euler/problem_136/__init__.py

Whitespace-only changes.

Diff for: project_euler/problem_136/sol1.py

+23
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)