fn main() {
let n = 1000;
let mut is_prime = vec![true; n+1];
is_prime[0] = false;
is_prime[1] = false;
for i in 2..=n {
if is_prime[i] {
println!("{}", i);
let mut j = i * i;
while j <= n {
is_prime[j] = false;
j += i;
}
}
}
}
fn main() {
let n = 1000;
let mut is_prime = vec![false; n+1];
is_prime[2] = true;
for i in (3..=n).step_by(2) {
is_prime[i] = true;
}
for i in 3..=((n as f64).sqrt() as usize) {
if is_prime[i] {
let mut j = i * i;
while j <= n {
is_prime[j] = false;
j += i * 2;
}
}
}
for i in (2..=n).filter(|&x| is_prime[x]) {
println!("{}", i);
}
}