eratosthing

0.0.4 • Public • Published

Build Status

This implements in JavaScript an online algorithm for finding successive primes in O(n log n) using a priority queue of composites, as proposed by Melissa O'Neill in her 2008 The Genuine Sieve of Eratosthenes.

Finding her paper allowed me to reduce runtime by 60% by starting each filter at at n^2, rather than n*2, and by using her unrolled wheel of candidates.

Installation

npm install eratosthing

Usage

const eratosthing = require("eratosthing");
let generator = eratosthing();
let value = generator.next().value;

Testing

npm test

/eratosthing/

    Package Sidebar

    Install

    npm i eratosthing

    Weekly Downloads

    7

    Version

    0.0.4

    License

    ISC

    Last publish

    Collaborators

    • bluej100