Skip to content

Instantly share code, notes, and snippets.

@tumdum

tumdum/b.rs Secret

Created December 23, 2017 08:06
Show Gist options
  • Save tumdum/6781e786ee802861385c0a76dfa631b1 to your computer and use it in GitHub Desktop.
Save tumdum/6781e786ee802861385c0a76dfa631b1 to your computer and use it in GitHub Desktop.
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