1
0
This commit is contained in:
2026-02-04 11:15:03 +08:00
commit 8b20a5dd21
125 changed files with 4177 additions and 0 deletions

7
problems/p3/Cargo.toml Normal file
View File

@@ -0,0 +1,7 @@
[package]
name = "p3"
version = "0.1.0"
edition = "2024"
[dependencies]
primal = "0.3.3"

12
problems/p3/src/main.rs Normal file
View File

@@ -0,0 +1,12 @@
use primal::Sieve;
fn largest_prime_factor(input: u64) -> u64 {
let sieve = Sieve::new(1_000_000);
let factors = sieve.factor(input as usize).unwrap();
factors.last().unwrap().0 as u64
}
fn main() {
println!("{}", largest_prime_factor(600851475143));
}