Library to enumerate all natural number lists with a target sum.
npm install summationsshell
npm install summations
`
The library can be imported in the usual ways:
`javascript
var summations = require('summations');
`
The library also supports standalone usage in browsers:
`html
`
Examples
It is possible to enumerate all possible lists of natural numbers of a given length that add up to a target sum.
`javascript
var results = summations.sumLen(2, 3);
`
Given the object above, we can query it for each value
`javascript
> results
[
[1, 1, 0],
[0, 1, 1],
[1, 0, 1],
[2, 0, 0],
[0, 2, 0],
[0, 0, 2],
]
`
Testing
Unit tests are included in test/test.js. They can be run using Mocha:
`javascript
npm test
``