le-triangle-de-pascal

0.0.2 • Public • Published

Le Triangle de Pascal

Why?

Why not?! It was in a list of "Interview tests for JavaScript developers" so I gave it a go.

But why?

To exercise the mind!

Install

npm install le-triangle-de-pascal

Usage

var ltdp = require('le-triangle-de-pascal')

console.log(ltdp(5))

Results in:

[[1][1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]]

Or if you'd like the pretty version:

[
      [1]
     [1,1],
    [1,2,1],
   [1,3,3,1],
  [1,4,6,4,1]
]

Todo

  • Make an option for prettying up the output (will never get around to it)

Readme

Keywords

Package Sidebar

Install

npm i le-triangle-de-pascal

Weekly Downloads

1

Version

0.0.2

License

MIT

Last publish

Collaborators

  • adrianblynch