Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 965b1ff

Browse files
authoredOct 31, 2021
Improve Project Euler problem 078 solution 1 (TheAlgorithms#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

Lines changed: 7 additions & 0 deletions
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)
Please sign in to comment.