
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
prime-number
Advanced tools
check if a number is prime
Is it 1 a prime? Some years ago I created a djembe rhythm generated by prime numbers, and it sounds good if 1 is considered prime. However, the algorithm implemented here defines 1 as a not prime.
With npm do
npm install prime-number
As you might expect, you can simply do
import isPrime from 'prime-number'
console.log(isPrime(19)) // true
You can also use CommonJS.
const isPrime = require('prime-number')
Clone this repo and install packages for benchmarks with --no-save
flag.
npm install check-prime is-prime --no-save
Then run benchmark scripts.
Using this prime-number
package.
npm run benchmark:prime-number
Found 8363 primes
Primality benchmark: 7.064ms
Using is-prime package.
npm run benchmark:is-prime
Found 8363 primes
Primality benchmark: 7.045ms
Using check-prime package.
npm run benchmark:check-prime
Found 8363 primes
Primality benchmark: 23.785ms
FAQs
check if a number is prime
The npm package prime-number receives a total of 39 weekly downloads. As such, prime-number popularity was classified as not popular.
We found that prime-number demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.