Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
quick-primefactors
Advanced tools
Readme
Compute a number's prime factors as quickly as possible, using a cached Sieve of Eratosthenes. This is especially helpful to lookup many numbers' factors one after another.
$ npm install quick-primefactors
var pf = require('quick-primefactors');
// Simple examples
console.log(pf(47)); // [47]
console.log(pf(48)); // [2, 2, 2, 2, 3]
console.log(pf(51)); // [3, 17]
console.log(pf(100)); // [2, 2, 5, 5]
// More challenging examples
console.log(pf(3000000)); // [2, 2, 2, 2, 2, 2, 3, 5, 5, 5, 5, 5, 5]
// took less than 0.5 seconds
console.log(pf(2987000)); // [2, 2, 2, 5, 5, 5, 29, 103]
// took less than 0.0005 seconds
This module uses a cached Sieve of Eratosthenes for constant time lookup. A new one will be automatically generated if the number you're testing is larger than the currently cached sieve's upper bound.
For best results, lookup your highest number first. This will ensure the sieve is only calculated a single time.
To run the test suite, first install the dependencies, then run npm test
:
$ npm install
$ npm test
To test code coverage:
$ npm run cover
FAQs
Quickly get a number's prime factors, using a cached Sieve of Eratosthenes
The npm package quick-primefactors receives a total of 1 weekly downloads. As such, quick-primefactors popularity was classified as not popular.
We found that quick-primefactors demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.