Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

sieve-of-sundaram

harrisjose22ISC1.0.0

JavaScript implementation of the Sieve of Sundaram for finding prime numbers.

sundaram, sieve, primes, fast, primesieve, primenumber

readme

Sieve of Sundaram

Sieve of Sundaram implemented in JavaScript

Algorithm

Any contributions to make this better are welcome :)

Install

npm install sieve-of-sundaram

Usage

Note : For all practical purposes, you should be using the Sieve of Eratosthenes which is available as a module here

var sieve-of-sundaram = require('sieve-of-sundaram')
var primes = sieve-of-sundaram(100)
console.log(primes)
//
[ 1,
  2,
  3,
  5,
  7,
  11,
  13,
  17,
  19,
  23,
  29,
  31,
  37,
  41,
  43,
  47,
  53,
  59,
  61,
  67,
  71,
  73,
  79,
  83,
  89,
  97 ]