1.0.0 • Published 8 years ago

sieve-of-sundaram v1.0.0

Weekly downloads
3
License
ISC
Repository
github
Last release
8 years ago

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 ]