npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

primelist

v1.0.0

Published

Fast prime lookup using precomputed data for rapid prime checks and nth prime retrieval.

Readme

Primelist

Primelist offers lightning-fast prime lookups and nth prime retrieval by leveraging a precomputed dataset of the first 50 million primes. This eliminates the need for on‑the‑fly prime testing, ensuring constant-time performance for prime checks and retrieval operations.

Overview

Rather than calculating primes at runtime—a process that can be slow and resource‑intensive for large numbers—Primelist loads and caches its precomputed dataset into an efficient internal mapping of prime ranges. This design enables rapid prime verification and nth prime lookups without incurring heavy computation at runtime.

The prime data is provided by t5k.org, and we sincerely thank them for making this prime list available.

Installation

Install primelist via npm:

npm install primelist

Or using yarn:

yarn add primelist

Usage

Import the API functions into your project:

import {
  isPrime,
  getNthPrime,
  getPrimeIndex,
  primesInRange,
  getNextPrime,
  getPrevPrime,
  getNextNPrimes,
  getPrevNPrimes
} from 'primelist';

console.log(isPrime(7));           // true
console.log(getNthPrime(100));     // returns the 100th prime number
console.log(getPrimeIndex(7));     // returns 4 (1-indexed position)
console.log(primesInRange(50, 100)); // returns all primes between 50 and 100
console.log(getNextPrime(97));     // returns the next prime after 97
console.log(getPrevPrime(97));     // returns the previous prime before 97
console.log(getNextNPrimes(97, 5));  // returns the next 5 primes after 97
console.log(getPrevNPrimes(97, 5));  // returns the previous 5 primes before 97

Contributing

Contributions to improve performance, extend the API, or expand the dataset are welcome. Please open issues or pull requests on the repository to discuss improvements.

License

Primelist is distributed under the MIT License. For more details, please refer to the LICENSE.