Project Euler Problem 25 Pitfalls

Project Euler problem 25 is reasonably straighforward. It asks you to find the first term in the Fibonacci sequence with more than 1000 digits. In ones like these, not reading the question properly is more likely to be your downfall than anything else. So:

Give the number of the first term which has 1000 digits, not the 1000-digit number itself

Make sure your Fibonacci number generator gives you the sequence correctly: ie F(1)=1 and F(2)=1. If you have F(1)=1 and F(2)=2, you’ll be off by one!

Lastly, and this only really applies to my own thickness… If the comment for your Fibonacci number generator says “returns nth Fibonacci number”, make sure it returns the nth Fibonacci number and not a Fibonacci number less than n.

If you’re getting a number greater than 5000 you’re off, recheck. Good luck!