An open API service indexing awesome lists of open source software.

https://github.com/semibran/catalan

Calculate Catalan numbers
https://github.com/semibran/catalan

Last synced: 8 months ago
JSON representation

Calculate Catalan numbers

Awesome Lists containing this project

README

          

# catalan
![C(5) = 42 noncrossing partitions of a 5-element set](https://upload.wikimedia.org/wikipedia/commons/thumb/e/e7/Noncrossing_partitions_5.svg/220px-Noncrossing_partitions_5.svg.png)

A small function for calculating [Catalan numbers](https://en.wikipedia.org/wiki/Catalan_number).

## usage
[![NPM](https://nodei.co/npm/catalan.png?mini)](https://www.npmjs.com/package/catalan)
```js
> const catalan = require('catalan')
> catalan(5)
42

> catalan(-1)
NaN
```

## see also
- [`semibran/narayana`](https://github.com/semibran/narayana) - calculate Narayana numbers

## license
[MIT](https://opensource.org/licenses/MIT) © [Brandon Semilla](https://git.io/semibran)