Difference between revisions of "ZCubes/Pascal Triangle and Fibonacci"

From ZCubes Wiki
Jump to navigation Jump to search
(Created page with "==Pascal Triangle and Fibonacci== <br/> Pascal triangle can be generated easily in ZCubes. This video shows pattern of Fibonacci series using Pascal triangle using ZCubes. ==...")
 
Line 7: Line 7:
 
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
 
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
  
 +
===Code - Fibonacci and Pascal Triangle===
 +
<pre>
 +
FIBONNACI(100)
 +
b=PASCALTRIANGLE(100)
 +
b.map(
 +
function calcfib(r,i,d)
 +
{
 +
var fib=0;
 +
var j=0;
 +
for(var xi=i;xi>=0;xi--)
 +
{
 +
fib+=isNaN(d[xi][j])?0:d[xi][j];
 +
j++;
 +
}
 +
return(fib)
 +
}
 +
)
 +
</pre>
  
  

Revision as of 04:40, 18 August 2020

Pascal Triangle and Fibonacci


Pascal triangle can be generated easily in ZCubes. This video shows pattern of Fibonacci series using Pascal triangle using ZCubes.

Video


Pascal Triangle and Fibonacci














Code - Fibonacci and Pascal Triangle

FIBONNACI(100)
b=PASCALTRIANGLE(100)
b.map(
	function calcfib(r,i,d)
	{
		var fib=0;
		var j=0;
		for(var xi=i;xi>=0;xi--)
		{
			fib+=isNaN(d[xi][j])?0:d[xi][j];
			j++;
		}
		return(fib)
	}
)


<< About ZCubes


© Copyright 1996-2020, ZCubes, Inc.