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 2ee900c commit df249f2Copy full SHA for df249f2
1 file changed
project_euler/problem_190/sol1.py
@@ -33,16 +33,15 @@ def solution(n: int = 15) -> int:
33
>>> solution(5)
34
10
35
"""
36
-
37
- ans = 0
+ total = 0
38
for m in range(2, n + 1):
39
x1 = 2 / (m + 1)
40
- capital_p = 1.0
+ p = 1.0
41
for i in range(1, m + 1):
42
xi = i * x1
43
- capital_p *= pow(xi, i)
44
- ans += int(capital_p)
45
- return ans
+ p *= xi ** i
+ total += int(p)
+ return total
46
47
48
if __name__ == "__main__":
0 commit comments