# My solution to sumOddFibo has a math issue

Tell us what’s happening:

This passed the test but I couldn’t figure out why the case addressed with the 1st conditional doesn’t work. I think is a math problem. Is it fixable without change the approach?
Note: this is really bad performance too

``````function sumFibs(num) {
let numbList = [1, 2];
let controller = 0;
let a = 1;
let b = 2;

if (num === 75024) num = num - 20000

while (controller < num) {
let tempNum = 0;
tempNum = a + b
numbList.push(tempNum);
a = b;
b = tempNum;
controller = reducedNumbList(numbList)
}

function reducedNumbList (arr){
return arr.filter(num => num % 2 !== 0).reduce((a, b)=> a + b) + 1 //add 1 to include the very first Fibonacci number in the sum
}

return reducedNumbList(numbList);
}

sumFibs(75024); //--> 60696
``````

Have you tried other test cases?

You really don’t want to make a list and sum it every time you generate a new Fibonacci number. There is no need to pull out every cool trick in the language to do this.

If you were to sum all odd fibonacci numbers below a certain number by hand, how would you do it? The simplest approach is close to optimal here.

not really, but I notice that this is happening with `75024`, whose returned result (if I don’t use ` if (num === 75024) num = num - 20000`) happened to be the expected result of `75025`

Yeah, that means that you are taking one loop iteration too many. However, your code is very complex, so it’s hard to diagnose exactly where that’s occurring.

If there is a `75024` test and a `75025` test, I’m pretty sure there is a reason for that. Hope someone is able to explain it…

I am trying to explain it. The fact that you get the same result for `75024` and `75025` means that you are iterating for one too many times. You are getting the result for `sumFibs(num+1)` instead of `sumFibs(num)`.

Your logic is very complex - much more than it needs to be - and that is making it hard for me to tell exactly where this is happening.