pub fn sieve_of_eratosthenes(n: usize) -> Vec<bool> {
    let mut tbl = vec![true; n + 1];
    tbl[0] = false;
    tbl[1] = false;
    for p in 2..n {
        if tbl[p] {
            for q in (2 * p..).step_by(p).take_while(|&q| q <= n) {
                tbl[q] = false;
            }
        }
    }
    tbl
}
/// Sieve of Eratosthenes
/// O(n loglog n)
Sieve of Eratosthenes
O(n loglog n)
Sieve of Eratosthenes O ( n loglog n )
pub fn sieve_of_eratosthenes(n: usize) -> Vec<bool> {
    let mut tbl = vec![true; n + 1];
    tbl[0] = false;
    tbl[1] = false;
    for p in 2..n {
        if tbl[p] {
            for q in (2 * p..).step_by(p).take_while(|&q| q <= n) {
                tbl[q] = false;
            }
        }
    }
    tbl
}
pub fn sieve_of_eratosthenes ( n : usize ) -> Vec < bool > { let mut tbl = vec ! [ true n 1 ] ; tbl [ 0 ] = false ; tbl [ 1 ] = false ; for p in 2 .. n { if tbl [ p ] { for q in ( 2 * p .. ) . step_by ( p ) . take_while ( | & q | q <= n ) { tbl [ q ] = false ; } } } tbl }
Sieve of Eratosthenes
O(n loglog n)
Sieve of Eratosthenes O ( n loglog n )
n
usize
n
usize