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

Function solution

project_euler/problem_025/sol1.py:83–97  ·  view source on GitHub ↗

Returns the index of the first term in the Fibonacci sequence to contain n digits. >>> solution(1000) 4782 >>> solution(100) 476 >>> solution(50) 237 >>> solution(3) 12

(n: int = 1000)

Source from the content-addressed store, hash-verified

81
82
83def solution(n: int = 1000) -> int:
84 """
85 Returns the index of the first term in the Fibonacci sequence to contain
86 n digits.
87
88 >>> solution(1000)
89 4782
90 >>> solution(100)
91 476
92 >>> solution(50)
93 237
94 >>> solution(3)
95 12
96 """
97 return fibonacci_digits_index(n)
98
99
100if __name__ == "__main__":

Callers 1

sol1.pyFile · 0.70

Calls 1

fibonacci_digits_indexFunction · 0.85

Tested by

no test coverage detected