Fibonacci sequence: Difference between revisions

Content added Content deleted
(→‎{{header|Java}}: Added analytic method)
No edit summary
Line 335: Line 335:
return (long)((Math.pow(p, n) + Math.pow(q, n)) / Math.sqrt(5));
return (long)((Math.pow(p, n) + Math.pow(q, n)) / Math.sqrt(5));
}</java>
}</java>

=={{header|JavaScript}}==
<pre>fib = [0,1];
for(i = 2; i <= 20; i++)
fib[i] = fib[i - 1] + fib[i - 2];
alert(fib);</pre>


=={{header|Joy}}==
=={{header|Joy}}==