Skip to content

primeupto is an math library for JavaScript and Node.js. It help you to find all prime number.

License

Notifications You must be signed in to change notification settings

letskhabar/primeupto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

primeupto is an math library for JavaScript and Node.js. It help you to find all prime number.

Version license download download Fork Star watch

Features

  • find all prime number upto n.
  • find all prime number from m to n. // comming soon
  • find number of prime upto n.
  • find number of prime from m to n.
  • find a number is Prime or not.
  • Can be used in command line as well.
  • Runs on any JavaScript engine.
  • Is easily extensible.
  • Open source.

Usage

primeupto can be used in both node.js and in the browser.

Install primeupto using npm:

npm install primeupto
const {primeupto,primelength,isPrime} = require('primeupto');

console.log(primeupto(5));     // 2,3,5
console.log(primelength(5));   // 3
console.log(isPrime(5));       // true
console.log(primeupto(34));    // 2,3,5,7,11,13,17,19,23,29,31
console.log(primelength(34));  // 11
console.log(isPrime(34));      // false
console.log(primeupto(25));    // 2,3,5,7,11,13,17,19,23
console.log(primelength(25));  // 9
console.log(isPrime(25));      // false
console.log(primeupto(53));    // 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53
console.log(primelength(53));  // 16
console.log(isPrime(53));      // true

Run

node index.js

See the Getting Started for a more detailed tutorial.

Documentation

Clone the project from github:

git clone https://github.com/letskhabar/primeupto.git
cd primeupto

License

MIT, Copyright (C) 2020