Nuanced Pumpkin Mavens

    pascals-triangle

    0.1.1 • Public • Published

    pascal's triangle

    Get a triangular array of the binomial coefficients given a certain number of rows.

    npm version Build status Test coverage

    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

    Install

    npm i pascals-triangle

    DownloadsWeekly Downloads

    2

    Version

    0.1.1

    License

    MIT

    Last publish

    Collaborators

    • alebelcor