# @mathlib/sequences

> Mathematical sequence generator

Latest version **1.1.2** (published 2022-05-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mathlib/sequences
pnpm add @mathlib/sequences
yarn add @mathlib/sequences
bun add @mathlib/sequences
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2022-05-20 |
| First published | 2022-05-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Vivek Dinesh |
| Maintainers | butane |
| Keywords | mathlib, sequences, numbers, series, factorial, fibonacci, lazy, caterer, lucas, natural, pell, tribonacci, whole |

## Links

- npm: https://www.npmjs.com/package/@mathlib/sequences
- Repository: https://github.com/mathlib-js/sequences
- Homepage: https://github.com/mathlib-js/sequences#readme
- Issues: https://github.com/mathlib-js/sequences/issues
- npm.io page: https://npm.io/package/@mathlib/sequences

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 1.1.2 (latest) — 2022-05-20
- 1.1.1 — 2022-05-19
- 1.1.0 — 2022-05-15
- 1.0.2 — 2022-05-15
- 1.0.1 — 2022-05-15

## README

# @mathlib/sequences
Mathematical sequence generator

[![Build & Test](https://github.com/mathlib-js/sequences/actions/workflows/node.js.yml/badge.svg)](https://github.com/mathlib-js/sequences/actions/workflows/node.js.yml)

## Installation
```
npm install @mathlib/sequences
```

## Usage
```javascript
const sequences = require("@mathlib/sequences");

const fibonacciGenerator = sequences.fibonacci(5);
console.log([...fibonacciGenerator]); // 0, 1, 1, 2, 3

const infiniteFibonacciGenerator = sequences.fibonacci(Infinity);
for (let val of infiniteFibonacciGenerator) {
  console.log(val); // 0, 1, 1, 2, 3, ..., 55, 89, 144
  // Break when you have enough values
  if (val > 100) break;
}
```

Using ES6 imports
```javascript
import { fibonacci } from "@mathlib/sequences";

console.log([...fibonacci(5)]); // 0, 1, 1, 2, 3

for (let val of fibonacci(Infinity)) {
  console.log(val); // 0, 1, 1, 2, 3, ..., 55, 89, 144
  // Break when you have enough values
  if (val > 100) break;
}
```

## Available Sequences
| OEIS Link | Sequence ▼ | Generator | Parameters |
| --- | --- | --- | --- |
| [A000142](https://oeis.org/A000142) | Factorials | `factorial(limit)` | limit (Default 10) |
| [A000045](https://oeis.org/A000045) | Fibonacci Series | `fibonacci(limit)` | limit (Default 10) |
| [A000124](https://oeis.org/A000124) | Lazy Caterer's Sequence <br> (Central Polygonal Numbers) | `lazyCaterers(limit)` | limit (Default 10) |
| [A000032](https://oeis.org/A000032) | Lucas Numbers | `lucas(limit)` | limit (Default 10) |
| [A000027](https://oeis.org/A000027) | Natural Numbers | `natural(limit)` | limit (Default 10) |
| [A000129](https://oeis.org/A000129) | Pell Numbers | `pell(limit)` | limit (Default 10) |
| [A000073](https://oeis.org/A000073) | Tribonacci Series | `tribonacci(limit)` | limit (Default 10) |
| [A001477](https://oeis.org/A001477) | Whole Numbers | `whole(limit)` | limit (Default 10) |

---
_Source: https://npm.io/package/@mathlib/sequences · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
