JS cannot Fib > 1000 (ish)

node v8.17.0
version: 4.0.1
endpointsharetweet
A compact golden ratio generator. Creating exact same number from a decimating fibonacci sequence, or something.
var ShowOff = ( function () { var size = 1000000; var fibSeq = function (limit) { var root = [0,1]; while(root.length < limit) root.push(root[root.length - 2] + root[root.length - 1]); return root; }; return { fibonacci: { fibInit: function(set) { size = !set ? size : size * 0 + set; return size; }, seq: function (){ return fibSeq(size);}, }, }; })(); var temp = ShowOff.fibonacci.seq(); for (var i = 0; i<5; ++i) { console.log(temp.length); console.log(temp[temp.length - 11] / temp[temp.length - 12] ) ShowOff.fibonacci.fibInit(temp.length * .1); temp = ShowOff.fibonacci.seq(); } console.log(temp.length); console.log(temp);
Loading…

1 comment

  • posted 6 years ago by electric-u
    What is the quickest way to get golden mean to show for 1,000,000?

sign in to comment