-
-
Save tumdum/6781e786ee802861385c0a76dfa631b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn solve_b() { | |
let start : i64 = 65 * 100 + 100000; | |
let end = start + 17000 + 17; | |
let sqrt = |n: i64| (n as f64).sqrt() as i64; | |
let not_prime = |n: i64| (2..sqrt(n)+1).any(|v| n%v==0); | |
let p : usize = (start..end) | |
.filter(|n| (n-start)%17==0) | |
.filter(|n| not_prime(*n)) | |
.count(); | |
println!("{}", p); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment