MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / solution

Function solution

project_euler/problem_074/sol1.py:98–105  ·  view source on GitHub ↗

Return the number of chains with a starting number below one million which contain exactly n non-repeating terms. >>> solution(10,1000) 28

(num_terms: int = 60, max_start: int = 1000000)

Source from the content-addressed store, hash-verified

96
97
98def solution(num_terms: int = 60, max_start: int = 1000000) -> int:
99 """
100 Return the number of chains with a starting number below one million which
101 contain exactly n non-repeating terms.
102 >>> solution(10,1000)
103 28
104 """
105 return sum(1 for i in range(1, max_start) if chain_length(i) == num_terms)
106
107
108if __name__ == "__main__":

Callers 1

sol1.pyFile · 0.70

Calls 1

chain_lengthFunction · 0.85

Tested by

no test coverage detected