This is the problem: Euler 2nd Problem

In case your lazy to go into the site here is the question in code tags />

Even Fibonacci Sequence Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

Now for personal reason i decided to make this problem a bit easy. I eliminated the even problem and adding 10 integer max making the equation simpler and more understanding for me.

So the question now is this

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the first 10 terms. The 1st term would be a random integer multiply by 5.

Okay so here is my brain working:D

I created a function like so

function fiboNumSeq(){ var firstTerm = Math.floor(Math.random() * 5); var arrayList = new Array(9); arrayList[0] = firstTerm; } fiboNumSeq();

Thats what i have so far.

Now i could simply create a bunch of console.log(); adding the array terms in there but i find that coding messy. Im trying to use what i know to solve this. A switch statement wont really solve this neither would an if/else statement since im not trying to prove anything rather solve. I was thinking of a do/while, while, or for loop. What do you think?

Having issues figuring it out ? Any help is appreciated and if i left out any important information, then tell me so i can clarify />

PS: i was also thinking that i can for example find term 1 then multiply it times term 2, then term 3, etc. until i reach term 10 but like i mention that just seems to sloppy and not coder friendly.

PS: I just realize that to solve this i need a 2nd term to multiply against 1, well the second term would be another random digit (Not a decimal but rather an whole number ).

thank you

This post has been edited by **AndreeU17**: 16 August 2013 - 11:27 PM