Skip to content

Commit

Permalink
Improve Project Euler problem 078 solution 1 (TheAlgorithms#5708)
Browse files Browse the repository at this point in the history
* Add solution doctests

* Improve solution function
  • Loading branch information
MaximSmolskiy committed Oct 31, 2021
1 parent a94c621 commit 965b1ff
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions project_euler/problem_078/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@

def solution(number: int = 1000000) -> int:
"""
>>> solution(1)
1
>>> solution(9)
14
>>> solution()
55374
"""
Expand All @@ -34,6 +40,7 @@ def solution(number: int = 1000000) -> int:
if index > i:
break
item += partitions[i - index] * sign
item %= number
index += j
if index > i:
break
Expand Down

0 comments on commit 965b1ff

Please sign in to comment.