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

Function solution

project_euler/problem_039/sol1.py:40–51  ·  view source on GitHub ↗

Returns perimeter with maximum solutions. >>> solution(100) 90 >>> solution(200) 180 >>> solution(1000) 840

(n: int = 1000)

Source from the content-addressed store, hash-verified

38
39
40def solution(n: int = 1000) -> int:
41 """
42 Returns perimeter with maximum solutions.
43 >>> solution(100)
44 90
45 >>> solution(200)
46 180
47 >>> solution(1000)
48 840
49 """
50 triplets = pythagorean_triple(n)
51 return triplets.most_common(1)[0][0]
52
53
54if __name__ == "__main__":

Callers 1

sol1.pyFile · 0.70

Calls 1

pythagorean_tripleFunction · 0.85

Tested by

no test coverage detected