number-sequences
v1.2.4
Published
JS library to generate a variety of immutable number sequences.
Downloads
32
Readme
Number Sequences
JS library to generate a variety of immutable number sequences.
Installation
npm install number-sequences
Example
All number sequences return an immutable sequence object - the
API for this is as per the ImmutableJS Seq
type.
import { Arithmetic } from "number-sequences";
const seq = Arithmetic(1, 1);
seq.take(3).toArray(); // [1, 2, 3]
Available sequences
The following types of sequence are available with the following parameters being permitted for each.
Arithmetic(start, commonDifference)
Collatz(start)
Fibonacci()
Geometric(start, commonRatio)
Power(start)
Prime()
Triangle()
Twin(a, b)
NthPower(n)
Contributing
Build
npm build
Tests
npm test
npm run test:watch