Effective implementation of algorithms (Master Thesis)
Effective and error-free implementation of algorithms
|
#include <segmented_sieve.h>
Static Public Member Functions | |
static void | findPrimes (long long int n, SieveCallback *callback) |
Static Private Member Functions | |
static void | sieve (const vector< int > &primes, long long int segment_start, long long int delta, long long int n, SieveCallback *callback) |
Implementation of segmented sieve
The basic idea is to a) find all primes up to sqrt(n) (inclusive) b) sieve sucessive intervals of length sqrt(n)
static void math::prime_sieve::SegmentedSieve::findPrimes | ( | long long int | n, |
SieveCallback * | callback | ||
) | [inline, static] |
Find all primes less than n and report them to the supplied callback
n | |
callback | use this callback on each found prime |
static void math::prime_sieve::SegmentedSieve::sieve | ( | const vector< int > & | primes, |
long long int | segment_start, | ||
long long int | delta, | ||
long long int | n, | ||
SieveCallback * | callback | ||
) | [inline, static, private] |
Interval sieving