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

Project Euler #25: N-digit Fibonacci number

Problem
Submissions
Leaderboard
Discussions

This problem is a programming version of Problem 25 from projecteuler.net

The Fibonacci sequence is defined by the recurrence relation:

.

Hence the first 12 terms will be:

The term, , is the first term to contain three digits.
What is the first term in the Fibonacci sequence to contain digits?

Input Format

The first line contains an integer , i.e., number of test cases.
Next lines will contain an integer .

Constraints


Output Format

Print the values corresponding to each test case.

Sample Input

2
3
4

Sample Output

12
17

Author

shashank21j

Difficulty

Easy

Max Score

100

Submitted By

6450

Need Help?


View discussions
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits

Choose a translation


  • Contest Calendar
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature