thaw-sieve-of-eratosthenes

0.0.1 • Public • Published

thaw-sieve-of-eratosthenes

A JavaScript implementation of the Sieve of Eratosthenes, an ancient Greek prime number generator.

Build Status npm npm license Maintainability Known Vulnerabilities

Most of this project's infrastructure was stolen from Jason Mulligan's (avoidwork's) tiny-graph project.

Installation

To install the stable version:

npm install --save thaw-sieve-of-eratosthenes

Example

const engine = require('thaw-sieve-of-eratosthenes');

console.log(engine.sieve(20)); // [2, 3, 5, 7, 11, 13, 17, 19]

console.log(engine.factorize(72)); // [2, 2, 2, 3, 3]

API

factorize(n)

Returns the unique prime factorization of n as a list of integers

sieve(n)

Returns the list of all prime numbers less than n

License

MIT

Package Sidebar

Install

npm i thaw-sieve-of-eratosthenes

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

13 kB

Total Files

7

Last publish

Collaborators

  • tom-weatherhead