🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

prime-num

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prime-num

prime numbers

latest
Source
npmnpm
Version
2.0.1
Version published
Weekly downloads
13
1200%
Maintainers
1
Weekly downloads
 
Created
Source

prime-num 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. [ primes(n) ]

  • find all prime number between m to n. [ primebtw(m,n) ]

  • find number of prime upto n. [ primelength(n) ]

  • find number of prime between m to n. [ primebl(m,n) ]

  • find a number n is Prime or not. [ isPrime(n) ]

  • Can be used in command line as well.

  • Runs on any JavaScript engine.

  • Is easily extensible.

  • Open source.

Usage

prime-num can be used in both node.js and in the browser.

Install prime-num using npm:

npm install prime-num
const {primes,primelength,isPrime,primebtw,primebl} = require('prime-num');

console.log(primes(25));       // 2,3,5,7,11,13,17,19,23
console.log(primelength(25));  // 9
console.log(isPrime(25));      // false
console.log(primes(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
console.log(primebtw(53,10));  // 11,13,17,19,23,29,31,37,41,43,47,53
console.log(primebl(53,10));   // 12

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/prime-num.git
cd prime-num

License

MIT, Copyright (C) 2020

Keywords

prime-num

FAQs

Package last updated on 09 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts