CT093

Thousand-Digit Fibonacci

EasyAcceptance: 0.0%

The Fibonacci sequence is defined by F1 = 1, F2 = 1, and Fn = Fn-1 + Fn-2. F12 = 144, which is the first term to contain three digits. Given d, find the index of the first Fibonacci number to contain d digits.

Example 1:

Input: 3
Output: 12

Example 2:

Input: 1000
Output: 4782

Example 3:

Input: 10
Output: 45

Constraints:

1 <= d <= 5000

Tags:

math fibonacci sequences
Loading...
Test Cases:No test cases
No test cases available.