We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #25: N-digit Fibonacci number
  4. Discussions

Project Euler #25: N-digit Fibonacci number

Problem
Submissions
Leaderboard
Discussions

    You are viewing a single comment's thread. Return to all comments →

  • timofei_shatrov
    4 years ago+ 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.

    4|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature