Skip to content
P

Primesieve

Fast prime number generator

by kimwalischFree

#249in Education
0In stores

Description

primesieve is a command-line program and C/C++ library for generating prime numbers very quickly. It uses the segmented sieve of Eratosthene…

Highlights

  • Segmented sieve of Eratosthenes with wheel factorization
  • Cache-aware and multi-threaded
  • Primes and prime k-tuplets up to 2^64
  • Command-line tool and C/C++ library
  • CPU and memory stress testing
  • Packages for Windows, macOS, Linux and FreeBSD

Ratings & Reviews

No ratings yet

Be the first to rate Primesieve.

People also visit

C

cpp-pro

Writes, optimizes, and debugs C++ applications

AI Skills
Get
P

PARI/GP

A computer algebra system for fast computations in number theory

Education
Launch
T

tilegym-improve-cutile-kernel-perf

Iteratively optimize cuTile kernel performance through systematic profiling

AI Skills
Get
P

perf-profiler

Profiling CPU/memory hot paths, generating flame graphs

AI Skills
Get
T

trailofbits/constant-time-analysis

Detect compiler-induced timing side-channels in crypto code

AI Skills
Get
B

benchmark-optimization-loop

Convert 'make it faster' requests into a bounded measured optimization loop

AI Skills
Get

Primesieve FAQ

How do I install primesieve?

Use your package manager: winget install primesieve on Windows, brew install primesieve on macOS, sudo apt install primesieve on Debian/Ubuntu, sudo dnf install primesieve on Fedora, sudo pacman -S primesieve on Arch, pkg install primesieve on FreeBSD or sudo zypper install primesieve on openSUSE.

How large can the primes be?

It generates primes and prime k-tuplets up to 2^64.

Why is printing primes slower than counting them?

Printing and writing to files run single-threaded because they need sequential order. For maximum throughput, generate primes in memory with libprimesieve.

What algorithm does it use?

A segmented sieve of Eratosthenes with wheel factorization, plus a bucket sieve for primes above 2^32. Memory use is about 8 bytes per sieving prime per thread.

Can it stress test my computer?

Yes. It includes stress testing modes for both the CPU and memory.

What are the best Primesieve alternatives?

Popular alternatives to Primesieve include PARI/GP. See all Primesieve alternatives

Developer Stuff

Badges