`var x=0,  var y=1; var z;  fib[0] = 0; fib[1] = 1; for(i=2; i<=10; i++) {     alert(x+y);     fib[i]=x+y;     x=y;     z=y; }   I'm trying to get to generate a simple Fibonacci sequence but there no output. Can anybody let me know what's...`
`I need to calculate the index of a Fibonacci number with JavaScript, within the Fibonacci sequence. I need to do this without using recursion, or a loop. I found the following formula in the Math forum:     n=?log?(F?5?+12)?   and coded it in JavaScr...`
`I have the memoization fibonacci code and I am having trouble figuring out what the time complexity is of it:  function fibMemo(index, cache) {   cache = cache || [];   if (cache[index]) return cache[index];   else {     if (index < 3) return 1;...`
`function fibo() { var first,second,add; for(var i=0;i<4000;i++){     if(i === 0){         first = 1;         second = 2;     }     add = first + second;     first = second;     second = add;  }  alert(add);  }  fibo();   not working shows infinity...`
`Trying to get my fibonacci sequence to work using recursion but am running into the error maximum callstack exceeded.  Code:  var genFib = function(count, limit, fibArray) {   if (count === undefined || count === null) {     var count = 0;   }    if...`
`I've seen several posts on generating a given fibonacci sequence, such as this one. However, I can't figure out how to generate the sequence (return an array) of fibonnaci numbers for a given n using recursion.  What I have clearly doesn'...`
`I am trying to successfully complete this challenge on the Rosalind page. The challenge is:     Given: Positive integers n?40 and k?5.      Return: The total number of rabbit pairs that will be present after n months if we begin with 1 pair and in ea...`
`Yet Another (Project Euler) Fibonacci Question: Using (vanilla) javascript, I'm trying to sum the even numbers <= a given limit:  First, something is wrong with my 'if' statement, as some of the results (below) are wrong:  function fib...`
`I m trying to solve https://www.spoj.com/problems/FIBOSUM/ problem.  MOD = 1000000007;  function copy(a, b) {     a[0][0] = b[0][0];     a[0][1] = b[0][1];     a[1][0] = b[1][0];     a[1][1] = b[1][1];  }  function multiply(fib, base) {     let mat =...`
`I need to create a web server with rest service in node.js. The server have to find a given input is Fibonacci or not. If it is Fibonacci, find the next number in Fibonacci sequence.  So I just write a simple program for finding Fibonacci number, but...`

# Top Questions

©2020 All rights reserved.