sieve-of-sundaram
v1.0.0
Published
JavaScript implementation of the Sieve of Sundaram for finding prime numbers.
Downloads
6
Maintainers
Readme
Sieve of Sundaram
Sieve of Sundaram implemented in JavaScript
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 ]