Licence
MIT
Version
0.1.1
Deps
0
Vulns
0
Weekly
0
DeprecatedThis package is deprecated
pascal's triangle
Get a triangular array of the binomial coefficients given a certain number of rows.
Install
npm install --save pascals-triangle
Usage
var triangle = require('pascals-triangle');
triangle(0); // [ [ 1 ] ]
triangle(1); // [ [ 1 ], [ 1, 1 ] ]
triangle(2); // [ [ 1 ], [ 1, 1 ], [ 1, 2, 1 ] ]
API
triangle(rows)
Returns a matrix (array of arrays) containing the values of the rows in order from top to bottom.
rows
Type: number
The number of rows or iterations to produce. It's a zero-based index, so if you want the first level you'd pass in 0.
License
MIT Alejandro Beltrán