Skip to content

Commit 965b1ff

Browse files
Improve Project Euler problem 078 solution 1 (#5708)
* Add solution doctests * Improve solution function
1 parent a94c621 commit 965b1ff

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

project_euler/problem_078/sol1.py

+7
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121

2222
def solution(number: int = 1000000) -> int:
2323
"""
24+
>>> solution(1)
25+
1
26+
27+
>>> solution(9)
28+
14
29+
2430
>>> solution()
2531
55374
2632
"""
@@ -34,6 +40,7 @@ def solution(number: int = 1000000) -> int:
3440
if index > i:
3541
break
3642
item += partitions[i - index] * sign
43+
item %= number
3744
index += j
3845
if index > i:
3946
break

0 commit comments

Comments
 (0)