Iterate over primes using primesieve::iterator.
#include <iostream>
int main()
{
uint64_t sum = 0;
for (; prime < 1000000000ull; prime = it.
next_prime())
sum += prime;
std::cout << "Sum of the primes below 10^9 = " << sum << std::endl;
std::cout << prime << std::endl;
return 0;
}
primesieve::iterator allows to easily iterate over primes both forwards and backwards.
Definition: iterator.hpp:33
void skipto(uint64_t start, uint64_t stop_hint=get_max_stop())
Reset the primesieve iterator to start.
uint64_t next_prime()
Get the next prime.
Definition: iterator.hpp:66