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

Function solution

project_euler/problem_164/sol1.py:51–61  ·  view source on GitHub ↗

Solves the problem for n_digits number of digits. >>> solution(2) 45 >>> solution(10) 21838806

(n_digits: int = 20)

Source from the content-addressed store, hash-verified

49
50
51def solution(n_digits: int = 20) -> int:
52 """
53 Solves the problem for n_digits number of digits.
54
55 >>> solution(2)
56 45
57 >>> solution(10)
58 21838806
59 """
60 cache: dict[str, int] = {}
61 return solve(digit=n_digits, prev1=0, prev2=0, sum_max=9, first=True, cache=cache)
62
63
64if __name__ == "__main__":

Callers 1

sol1.pyFile · 0.70

Calls 1

solveFunction · 0.70

Tested by

no test coverage detected