Skip to content

A fast prime generator to generate numbers on demand on the fly

License

Notifications You must be signed in to change notification settings

akgupta89/fast-prime-gen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fast Prime Gen

A NodeJS/JavaScript package to generate prime numbers fast and efficiently

Overview

Fast Prime Gen generates prime numbers procedurally on the fly. Instead of using a pre-generated list, this tool will spit out the next prime number using an algorithm based on Vladmir Agafonkin's work.

How To Use

Install the Package

npm install fast-prime-gen

Examples

Initialize the Generator

const PostponedSieve = require('fast-prime-gen'); 

const generator = PostponedSieve();

Run the generator one time

console.log(generator.next().value);

Run the generator multiple times

console.log(generator.next().next().next().value);

Skip entries

console.log(generator.skip(100).next().value);

About

A fast prime generator to generate numbers on demand on the fly

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published