include/hurchalla/factoring/detail/miller_rabin_bases/verify_tables/test_mr16_tables.cpp
// Initialize a bit vector that marks all prime indexes as true up to size,
// and marks all non-prime indexes as false.
Initialize a bit vector that marks all prime indexes as true up to size,
and marks all non-prime indexes as false.
Initialize a bit vector that marks all prime indexes as true up to size and marks all non - prime indexes as false .
std::vector<bool> init_primes(std::uint64_t size)
{
    using std::uint64_t;
    std::vector<bool> primes(size, true);
    primes[0] = false;
    primes[1] = false;
    const auto pb = primes.begin();
    const auto pe = primes.end();
    for (uint64_t j=2*2; j<size; j+=2)
        primes[j] = false;
    for (uint64_t i=3; i*i<size; i = std::find(pb+(i+1),pe,true) - pb)
        for (uint64_t j=i*i; j<size; j+=(2*i))
            primes[j] = false;
    return primes;
}
std :: vector < bool > init_primes ( std :: uint64_t size ) { using std :: uint64_t ; std :: vector < bool > primes ( size , true ) ; primes [ 0 ] = false ; primes [ 1 ] = false ; const auto pb = primes . begin ( ) ; const auto pe = primes . end ( ) ; for ( uint64_t j = 2 * 2 ; j < size ; j += 2 ) primes [ j ] = false ; for ( uint64_t i = 3 ; i * i < size ; i = std :: find ( pb + ( i + 1 ) , pe , true ) - pb ) for ( uint64_t j = i * i ; j < size ; j += ( 2 * i ) ) primes [ j ] = false ; return primes ; }
Initialize a bit vector that marks all prime indexes as true up to size,
and marks all non-prime indexes as false.
Initialize a bit vector that marks all prime indexes as true up to size and marks all non - prime indexes as false .