0.0.1 • Published 5 years ago

thaw-sieve-of-eratosthenes v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

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