init
This commit is contained in:
7
problems/p10/Cargo.toml
Normal file
7
problems/p10/Cargo.toml
Normal file
@@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "p10"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
primes = "0.4.0"
|
||||
14
problems/p10/src/main.rs
Normal file
14
problems/p10/src/main.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
use primes::{PrimeSet, Sieve};
|
||||
|
||||
fn main() {
|
||||
let mut pset = Sieve::new();
|
||||
let mut sum: u64 = 0;
|
||||
for i in pset.iter() {
|
||||
if i < 2000000 {
|
||||
sum += i;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
println!("{sum}");
|
||||
}
|
||||
Reference in New Issue
Block a user