Project Euler #25: N-digit Fibonacci number

  • + 0 comments

    The closed-form formula is the best way to solve this problem. It can be inaccurate for calculating exact values of Fibonacci numbers, but we need to calculate log10 of a Fibonacci number here and particular accuracy is not needed. Basically log10(phi^k/sqrt(5)) + 1 is a good estimate for the number of digits of a Fibonacci number and this formula is easily simplified to a linear equation to find k.