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

Function solution

project_euler/problem_145/sol1.py:116–129  ·  view source on GitHub ↗

To evaluate the solution, use solution() >>> solution(3) 120 >>> solution(6) 18720 >>> solution(7) 68720

(max_power: int = 9)

Source from the content-addressed store, hash-verified

114
115
116def solution(max_power: int = 9) -> int:
117 """
118 To evaluate the solution, use solution()
119 >>> solution(3)
120 120
121 >>> solution(6)
122 18720
123 >>> solution(7)
124 68720
125 """
126 result = 0
127 for length in range(1, max_power + 1):
128 result += reversible_numbers(length, 0, [0] * length, length)
129 return result
130
131
132def benchmark() -> None:

Callers 1

sol1.pyFile · 0.70

Calls 1

reversible_numbersFunction · 0.85

Tested by

no test coverage detected