Problem 2: Even Fibonacci Numbers. Vague instruction?

Tell us what’s happening:
I am not understanding what the instruction is saying.

How is this test case returning… fiboEvenSum(10) should return 188?

When the sum of even numbers in the first 10 numbers come out to be…

1, 2, 3, 5, 8, 13, 21, 34, 55, 89. 2 + 8 + 34 = 44.

Or If I add together even indexes…

1, 2, 3, 5, 8, 13, 21, 34, 55, 89. 1 + 3 + 8 + 21 + 55 = 88.

Your code so far


function fiboEvenSum(number) {
  // You can do it!2+8+34+
  return true;
}

fiboEvenSum(10);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/coding-interview-prep/project-euler/problem-2-even-fibonacci-numbers

The starting sequence is off by 1 or 2 if I’m remembering correctly. You must account for that offset if you want to pass the challenge.

1 Like

I agree there is room for improvement in the instructions.

I think they want the sum of the even terms only so you must find the first 11 even terms ( if the parameter says index is 10) in the series
1 2 3 5 8 13 21 34 55 89 144

and add the even numbers only:
2+8+34+144 = 188

Thanks, Looks like I have to increment the parameter by one then.

1 Like