Skip to content

Commit 8afd379

Browse files
committed
Added doctest for solution() in project_euler/problem_74/sol1.py
1 parent 15e20e8 commit 8afd379

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

project_euler/problem_74/sol1.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,14 @@ def chain_length(n: int, previous: set = None) -> int:
9595
return ret
9696

9797

98-
def solution(n: int = 60) -> int:
98+
def solution(num_terms: int = 60, max_start: int = 1000000) -> int:
9999
"""
100100
Return the number of chains with a starting number below one million which
101101
contain exactly n non-repeating terms.
102+
>>> solution(10,1000)
103+
28
102104
"""
103-
return sum(1 for i in range(1, 1000000) if chain_length(i) == n)
105+
return sum(1 for i in range(1, max_start) if chain_length(i) == num_terms)
104106

105107

106108
if __name__ == "__main__":

0 commit comments

Comments
 (0)