Project Euler: Problem 2 seems badly written?

This is not about how to solve it but about the problem itself.

It states:

So, find first n terms, choose even values among them, compute sum.

I wonder if I could get an example of, say, the first ten terms…

Amazing! Yes, I can count all right and those are ten terms. So, let’s see, evens are 34, 8 and 2, which makes the answer for n=10 to be 44, right?

But you said the first 10 terms are those, how can you get to that result?

Oh, I see what’s happening, the next term would be 55+89=144, and then the sum would be that 188 value you’re looking for. But that’s the term that comes after the tenth term, (a.k.a. the eleventh term). I’m guessing you meant that fiboEvenSum(11) should return 188?

You do remmber you said what the first ten terms were just a minute ago, right?

Ok, I’m done with you, posting to the forum.

By the way, all the test are similarly off. What was the quote? The two hardest things in computer science are cache invalidation, naming things and off-by-one errors. :laughing:

Can somebody help, I’m not quite getting why no one has struggled with this yet, so I still assume there’s something I’m not getting about the problem’s description, but I can’t find where I’m going wrong.

If you’re interested, I solved it just fine anyway, but can’t get it out of my head.

Thanks!

PS: If more people feel like this is an issue, I’ll gladly try to find my way around navigating the project on Github and making a PR there, but I’ve read I should try to get confirmation first… :wink:

1 Like

I believe that the description of the Project Euler problems come from Project Euler itself.

Thanks for your reply!

Actually, at least in this case, they differ.

The corresponding Project Euler question is a slight variation, asking to compute terms lower than four million instead of asking for the tenth term. I have no problems understanding the one hosted on Euler, and the solution was actually what I expected.

In any case, even if it was the same (it isn’t) I’m still curious. Is anyone else seeing the same issue I’m seeing with the current iteration of this problem on FCC?

Thanks!

This is basically what the description on FCC is saying: “By considering the terms in the Fibonacci sequence whose values do not exceed 10, find the sum of the even-valued terms.”

Which means: [1, 2, 3, 5, 8] because the next term would be 13 which exceeds 10.
So fiboEvenSum(10) should actually return 2 + 8 = 10