primesieve Documentation

# About

primesieve is a C/C++ library for fast prime number generation. It generates the primes below 10^9 in just 0.2 seconds on a single core of an Intel Core i7-6700 3.4GHz CPU. primesieve can generate primes and prime k-tuplets up to 2^64. primesieve's memory requirement is about pi(sqrt(n)) * 8 bytes per thread, its run-time complexity is O(n log log n) operations. For more information please visit http://primesieve.org.

The recommended way to get started is to first have a look at a few C/C++ example programs. The most common use cases are storing primes in a vector (or array) and iterating over primes using next_prime() or previous_prime().

You can install libprimesieve either using your distribution's package manager (if it is available) or you can build and install it yourself, this is explained at http://primesieve.org/build.html.

# C++ API

- primesieve.hpp - primesieve C++ header.
- store_primes_in_vector.cpp - Example that shows how to store primes in a std::vector.
- primesieve_iterator.cpp - Example that shows how to iterate over primes using primesieve::iterator.
- count_primes.cpp - Example that shows how to count primes.

# C API

- primesieve.h - primesieve C header.
- store_primes_in_array.c - Example that shows how to store primes in an array.
- primesieve_iterator.c - Example that shows how to iterate over primes using primesieve_iterator .
- count_primes.c - Example that shows how to count primes.